[ python-Feature Requests-960454 ] old/new class documentation

SourceForge.net noreply at sourceforge.net
Wed Apr 12 20:07:35 CEST 2006


Feature Requests item #960454, was opened at 2004-05-25 18:33
Message generated for change (Settings changed) made by jimjjewett
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=960454&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Jim Jewett (jimjjewett)
Assigned to: Nobody/Anonymous (nobody)
Summary: old/new class documentation

Initial Comment:
The distributed documentation refers to old and 
new-style classes, but they do not appear in the index, 
and the difference is not explained.  (Users who ask are 
referred to documentation on www.python.org, which is 
not currently shipped with the default distrubution.)  

As best I understand it, the only differences are:

(1)  New-style classes inherit from object.  
Because of this inheritance, new-style classes have a 
few extra capabilities, such as descriptors and super.

(2)  Method Resolution Order can be different in cases of 
multiple inheritance.

(3)  New style classes take precedence over old-style 
classes when doing rich comparison.

(4)  If rich comparison fails, numeric coercion will be 
attempted if -- and only if -- at least one of the objects 
is an old-style class.


----------------------------------------------------------------------

>Comment By: Jim Jewett (jimjjewett)
Date: 2006-04-12 14:07

Message:
Logged In: YES 
user_id=764593




----------------------------------------------------------------------

Comment By: Žiga Seilnacht (zseil)
Date: 2006-04-10 10:07

Message:
Logged In: YES 
user_id=1326842

This seems like a duplicate of bug #960340, which
was closed when section New-style and classic classes
was added to the Python Reference Manual
(see http://docs.python.org/dev/ref/node33.html).


----------------------------------------------------------------------

Comment By: Edward Diener (eldiener)
Date: 2004-08-01 19:53

Message:
Logged In: YES 
user_id=490593

New style classes, with all their new attributes, member 
functions, static methods, and class methods, need to be 
documented in the official Python distribution. Included in this 
is the explanation of metaclasses and how to use them. 
Essentially Guido's paper on new style classes, reworked to fit 
within the existing documentation framework, should be added 
to the official documantation..

----------------------------------------------------------------------

Comment By: Jim Jewett (jimjjewett)
Date: 2004-05-26 11:21

Message:
Logged In: YES 
user_id=764593

Found a new difference -- you can't assign to the __bases__ 
or __name__ of a new-style class, and you can't usually 
assign to it's __class__.

----------------------------------------------------------------------

Comment By: Jim Jewett (jimjjewett)
Date: 2004-05-26 10:05

Message:
Logged In: YES 
user_id=764593

Given that the differences are almost -- but not entirely -- 
extra options for new-style classes, the language lawyer 
section on classes (ref/7.6) might be a good location.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=960454&group_id=5470


More information about the Python-bugs-list mailing list