By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,846 Members | 1,803 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,846 IT Pros & Developers. It's quick & easy.

Introspect the class name of object?

P: n/a
Hi all,

How to get the class name of an object from an introspect way?
For example,
Class cls:pass

obj = cls()

I want to get function(obj) = 'cls'

Best regards,
Davy
Nov 22 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Wed, 21 Nov 2007 18:55:21 -0800, Davy wrote:
Hi all,

How to get the class name of an object from an introspect way? For
example,
Class cls:pass

obj = cls()

I want to get function(obj) = 'cls'

obj.__class__ returns the class itself.

obj.__class__.__name__ returns the name of the class as a string.

--
Steven.
Nov 22 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.