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

SourceForge.net noreply at sourceforge.net
Mon Aug 2 01:53:15 CEST 2004


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

Category: Documentation
Group: None
Status: Open
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: 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