Python "object" as root object

John A Meinel john at arbash-meinel.com
Wed May 25 14:28:55 BST 2005


Martin Pool wrote:

>On Wed, 2005-05-25 at 01:45 -0500, John A Meinel 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") not "do implicitly inherit
>from object", as in Java.  I don't mind adding it if it's useful or
>cleaner in any particular case.
>
>
>
As someone else mentioned, it allows you to use decorators, and the
super() function.

The problem is that I don't think you can do it later when you want to
subclass. If you can, then feel free to leave it like it is, but if not,
someone might want to use those functions in the future.

The fact that it was 'new class' versus 'old class' style, lead me to
believe that it is the recommended way (since it is the "new" way).

Python still works, but you don't get the advantages of the newer
language features.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050525/05077814/attachment.pgp 


More information about the bazaar mailing list