[Tutor] New-style classes

Lloyd Kvam pythontutor at venix.com
Sat Nov 1 14:55:08 EST 2003


One more comment.  A "classic" class has a base class defined as:
	class Base:

A newstyle class has a base of object
	class Base(object):
or one of the other built in types (e.g. dict or list).  I have not
encountered any cases where code was broken my switching to the new
style classes.

Lloyd Kvam wrote:

> http://www.python.org/doc/2.2.1/whatsnew/
> What's New in Python 2.2
> 
> http://www.python.org/2.2/descrintro.html
> Unifying types and classes in Python 2.2
> 
> The first link is by amk (just in case he's not watching the list).
> The second is by GvR and will probably make more sense after reading
> the section of amk's document dealing with the new classes.
> 
> 
> Daniel Ehrenberg wrote:
> 
>> I have heard about new-style classes, and I'm afraid
>> I'm using old-style classes (since I'm learning from a
>> book made for 2.0). Could somebody please explain what
>> new-style classes are and their benefit over old-style
>> classes?
>> Daniel Ehrenberg
>>
>> __________________________________
>> Do you Yahoo!?
>> Exclusive Video Premiere - Britney Spears
>> http://launch.yahoo.com/promos/britneyspears/
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> http://mail.python.org/mailman/listinfo/tutor
>>
> 

-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice:	603-653-8139
fax:	801-459-9582




More information about the Tutor mailing list