why are people still using classic classes?

Steve Holden steve at holdenweb.com
Fri Jan 14 22:53:30 CET 2005


Michael Hobbs wrote:

> Simon Wittber <simonwittber at gmail.com> wrote:
> 
>>I've noticed that a few ASPN cookbook recipes, which are recent
>>additions, use classic classes.
>>
>>I've also noticed classic classes are used in many places in the
>>standard library.
>>
>>I've been using new-style classes since Python 2.2, and am suprised
>>people are still using the classic classes.
>>
>>Is there a legitimate use for classic classes that I am not aware of?
>>Is there a project to specifically migrate standard library classes to
>>new-style classes?
> 
> 
> I'm guessing that the biggest contributor to the continued prevalence
> of classic classes is the official Python Tutorial:
>     http://docs.python.org/tut/node11.html#SECTION0011300000000000000000
> 
> I came into Python around the 2.2 timeframe and used the tutorial as
> my starting point. I had often read people referring to "classic
> classes" but assumed that it was some old pre-2.2 thing that I need
> not worry about. For the longest time, I had assumed that I was using
> new style classes because I created them exactly as prescribed in the
> 2.2 tutorial (which still hasn't changed for 2.3 or 2.4).
> 
> Now, classic classes are my habit and I see no compelling reason to
> put in the effort to change my habits.
> 

Since the only effort is the addition of

__meta class__ = type

at the head of your modules you could probably automate this without 
breaking too much code.

regards
  Steve
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list