__del__ methods

Ben Finney bignose+hates-spam at benfinney.id.au
Sun Jul 20 02:04:59 CEST 2008


"Robert Rawlins" <robert.rawlins at thinkbluemedia.co.uk> writes:

> What is the benefit of extending the base 'object' class? What does that
> give me that en empty, non subclassed object doesn't?

In Python 2.x, "classic" classes (which are not part of the unified
type hierarchy) are deprecated, and exist only for backward
compatibility with old code.

You need to create "new-style" classes
<URL:http://www.python.org/doc/newstyle/> by inheriting from some
class that is part of the unified type hierarchy; if there is no
obvious candidate, 'object' is the recommended choice.

In Python 3.0, classic classes are no longer supported and this issue
goes away.

-- 
 \     Q: “I've heard that Linux causes cancer...” Torvalds: “That's a |
  `\         filthy lie. Besides, it was only in rats and has not been |
_o__)                           reproduced in humans.” —Linus Torvalds |
Ben Finney



More information about the Python-list mailing list