Re: Find class of an instance?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hugo

    Re: Find class of an instance?

    Neal Becker schreef:
    Sounds simple, but how, given an instance, do I find the class?
    I always do that with .__class__, not sure whether it is the best way:
    >>class A:
    .... pass
    ....
    >>a = A()
    >>a.__class__
    <class __main__.A at 0xb7f01fbc>
    >>a.__class__ == A
    True
Working...