Accessing parent objects

Ben Finney ben+python at benfinney.id.au
Mon Mar 26 04:39:47 EDT 2018


Antoon Pardon <antoon.pardon at vub.be> writes:

> On 25-03-18 00:54, Steven D'Aprano wrote:
> > The trick is to use new-style classes that inherit from object, and
> > avoid the old-style classes that don't:
> >
> > # Good
> > class Spam(object):
> >     ...
> >
> > # Not so good
> > class Spam:
> >     ...
>
> How good is that when almost all classes in the standard library are
> old style classes?

That's a vague question. So, a vague answer: When that is the case, it's
quite good.

Is that satisfactory? Or would you care to elaborate on what the
question is?

-- 
 \      “Natural catastrophes are rare, but they come often enough. We |
  `\   need not force the hand of nature.” —Carl Sagan, _Cosmos_, 1980 |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list