Special Instance Attributes : Introduction « Class « Python Tutorial






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__








11.1.Introduction
11.1.1.Common operator overloading methods
11.1.2.Double Underscore __
11.1.3.Special Class Attributes
11.1.4.__dict__ is a dictionary representing its attributes:
11.1.5.Special Instance Attributes
11.1.6.Built-in Type Attributes
11.1.7.Metaclass Example
11.1.8.Related Modules and Documentation