When to derive from object?

Benjamin Kaplan benjamin.kaplan at case.edu
Tue Oct 13 13:44:59 EDT 2009


On Tue, Oct 13, 2009 at 1:34 PM, Anson Mackeracher <amackera at gmail.com> wrote:
> Can someone point me to some reason on why not to derive from Object
> when using Python >= 3.0? I am a Python novice, I need some
> background.
>

It's redundant. Python 3 cleaned up a lot of the warts that appeared
in Python over the years. Old-style classes (classes that didn't
inherit from object) were one of them. Every class in Python 3 is
derived from object whether you specify it or not.

> On Oct 13, 10:49 am, Bruno Desthuilliers <bruno.
> 42.desthuilli... at websiteburo.invalid> wrote:
>> Igor Mikushkin a écrit :
>>
>> > Hello all!
>>
>> > I'm a newbie to Python.
>>
>> Welcome onboard
>>
>> > Could you please say me when it is better to derive from "object" and
>> > when not?
>>
>> - When not : when using Python >= 3.0, or when already subclassing
>> another class.
>>
>> - When : any other case !-)
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list