Special Instance Attributes : Introduction : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Introduction »

 

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__



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Class
» Introduction