Find class of an instance?

Nikolaus Rath Nikolaus at rath.org
Wed Aug 6 14:34:33 EDT 2008


Neal Becker <ndbecker2 at gmail.com> writes:
> Sounds simple, but how, given an instance, do I find the class?


It does not only sound simple. When 'inst' is your instance, then

  inst.__class__

or

  type(inst) 

is the class.

Best,


   -Nikolaus

-- 
 »It is not worth an intelligent man's time to be in the majority.
  By definition, there are already enough people to do that.«
                                                         -J.H. Hardy

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C



More information about the Python-list mailing list