Python "object" as root object
Fredrik Lundh
fredrik at pythonware.com
Thu May 26 09:28:42 BST 2005
Martin Pool wrote:
>> I think it was python 2.2 or 2.3 where python introduced the 'object'
>> superclass. Basically all classes should really inherit from object at
>> the lowest level. That is what enables you to use functions like 'super()'
>
> Ah, I had heard of this change but had not realized it was "should
> inherit" (or as Fredrik says "may inherit")
I used the terms in the RFC sense: "should" means "always use this unless you
have very good reasons not to, and you understand the consequences", while
"may" means "truly optional; use if you feel that it enhances your product".
inheriting from object is truly optional.
(fwiw, in the mythical Python 3.0, all classes will most likely almost inherit from
object, whether you spell it out or not. adding it for "forward compatibility" only
is mostly pointless)
</F>
More information about the bazaar
mailing list