I'm trying to create 2 objects,
Aby defining as a regular Python classBby dynamically creating properties.
Once both the classes are created, I'm trying to print their dictionary and noticed that for Class B which is dynamically created the attribute "X" is not listed.
class A(object):
def __init__(self,x,y):
self.x = 0
self.y = 0
x = A(1,2)
print "Class A directory =",dir(x)
class B:pass
B().x = 5
y = B()
print "Class A directory =",dir(y)
Output
Class A directory = ['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'x', 'y']
Class B directory = ['__doc__', '__module__']