On Wed, 07 Aug 2019 14:39:00 -0400
Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote:

> On Wed, 7 Aug 2019 20:11:15 +0200, Manfred Lotz <ml_n...@posteo.de>
> declaimed the following:
> 
> >Hi there,
> >More often I see something like this:
> >
> >class Myclass:
> >...
> >
> >
> >but sometimes I see
> >
> >class Myclass(object):
> >...
> >
> >
> >Question: which way is preferable?  
> 
>       It's historical...
> 
>       Python v1.x had a form of classes.
> 
>       Python v2.x introduced "new-style" classes. "New-style"
> classes /had/ to inherit from "object", as they had different
> behavior from "v1.x old-style" classes which were still supported (it
> would have broken too many programs). Old-style were then deprecated,
> and one should have used new-style for new code.
> 
>       Python v3.x unified (removed old-style behavior differences)
> and all classes inherit from "object" whether one specifies object or
> not.
> 
> 

Thanks a lot for the explanations.

As a Python newbie (with no Pythons legacies) I only deal with Python 3.
So, I will happily ignore 'object'.

-- 
Manfred


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to