Times where one would use new style classes vs classic classes

Ben Finney bignose+hates-spam at benfinney.id.au
Thu Jul 3 01:16:35 EDT 2008


Quek <quekshuy at gmail.com> writes:

> I'd really like to know in the current context of Python 2.5,
> besides in the cases of multi-inheritance, where would I use new
> style classes? Is it a norm to use more new style classes even if I
> don't have multi-inheritance in the industry, open source projects,
> etc today?

Yes, it's the norm to use new-style classes. This makes one's classes
part of the Python type hierarchy, allowing features such as 'super',
'property', etc. to work correctly.

Use new-style classes for any new code you create. Old-style classes
are deprecated in Python 2.5 (even earlier than that I believe), and
will be removed in Python 3.0
<URL:http://wiki.python.org/moin/Python3.0>.

-- 
 \        “Good judgement comes from experience. Experience comes from |
  `\                              bad judgement.” —Frederick P. Brooks |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list