What's going on here?

Richie Hindle richie at entrian.com
Wed Nov 22 15:56:23 CET 2006


> What is subclassing adding to the class here?

A __dict__:

>>> o = object()
>>> dir(o)
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__',
'__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__']
>>> class C(object): pass
...
>>> c = C()
>>> dir(c)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__module__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__']

-- 
Richie Hindle
richie at entrian.com



More information about the Python-list mailing list