This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients amaury.forgeotdarc, belopolsky, stingray
Date 2008-03-11.00:29:23
SpamBayes Score 0.07658887
Marked as misclassified No
Message-id <1205195365.11.0.523330652181.issue2267@psf.upfronthosting.co.za>
In-reply-to
Content
Invoking a subclass's constructor is only an issue when subclass adds 
data members.  In this case, arithmetic methods need to be overridden.  
Note that my patch does not make __add__ and friends invoke subclass' 
constructor, only subclass' tp_alloc.

Existing code already does this in some cases.  For example,

>>> class d(datetime): pass
... 
>>> d.strptime('20080310', '%Y%m%d')
d(2008, 3, 10, 0, 0)
>>> d.now()
d(2008, 3, 10, 20, 27, 6, 303147)

I think date/datetime present a particularly compelling case for 
departing from the general rule.  These classes are minimal by design 
and need to be extended in many applications.
History
Date User Action Args
2008-03-11 00:29:25belopolskysetspambayes_score: 0.0765889 -> 0.07658887
recipients: + belopolsky, amaury.forgeotdarc, stingray
2008-03-11 00:29:25belopolskysetspambayes_score: 0.0765889 -> 0.0765889
messageid: <1205195365.11.0.523330652181.issue2267@psf.upfronthosting.co.za>
2008-03-11 00:29:24belopolskylinkissue2267 messages
2008-03-11 00:29:23belopolskycreate