Code goes first:
class A(object): def foo(self): self.foo = \'foo\' def bar(self): self.bar = \'bar\' cls_dict = dict(A.__dict__) #not
a.__dict__ is empty because none of the attributes have been initialized on the instance as there's no __init__() defined. Meanwhile, a class is an object, and it has initialized some attributes.
a.__dict__
__init__()
>>> A