Mega Code Archive

 
Categories / Python Tutorial / Class
 

Special Instance Attributes

I.__class__     Class from which I is instantiated I.__dict__    Attributes of I class C(object):     pass c = C()          dir(c)           print c.__dict__ print c.__class__ c.foo = 1 c.bar = 'SPAM' print '%d can of %s please' % (c.foo, c.bar) print c.__dict__