An example of calling vars() with a class instance : vars « Buildin Function « Python Tutorial






# Without arguments, return a dictionary corresponding to the current local symbol table. 
# With a module, class or class instance object as argument 
# (or anything else that has a __dict__ attribute), 
# returns a dictionary corresponding to the object's symbol table. 
# Reference from Python doc: http://docs.python.org/library/functions.html


class C(object):
     pass

c = C()
c.foo = 100
c.bar = 'Python'
print c.__dict__
print vars(c)








13.48.vars
13.48.1.An example of calling vars() with a class instance