Advocacy opportunity
Paul Prescod
paul at prescod.net
Sun Apr 4 22:52:09 EDT 2004
John Roth wrote:
>
> I wouldn't. To me, a root class is a common class that is **the**
> root of the object hierarchy, in some useful sense such as
> contributing numerous common methods. Granted, new style
> classes are rooted in object, but object doesn't seem to
> contribute much except for __getattribute__.
>>> isinstance(5, object)
True
>>> dir(object)
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__',
'__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__']
>>> dir(5)
['__abs__', '__add__', '__and__', '__class__', '__cmp__', '__coerce__',
'__delattr__', '__div__', '__divmod__', '__doc__', '__float__',
'__floordiv__', '__getattribute__', '__getnewargs__', '__hash__',
'__hex__', '__init__', '__int__', '__invert__', '__long__',
'__lshift__', '__mod__', '__mul__', '__neg__', '__new__', '__nonzero__',
'__oct__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__',
'__rdiv__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__',
'__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__',
'__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__',
'__rxor__', '__setattr__', '__str__', '__sub__', '__truediv__', '__xor__']
Paul Prescod
More information about the Python-list
mailing list