[issue4442] datetime not subclassable in the usual way

2008-11-26 Thread Chris Withers
Chris Withers <[EMAIL PROTECTED]> added the comment: But that isn't documented anywhere... -- assignee: -> georg.brandl components: +Documentation nosy: +georg.brandl type: feature request -> ___ Python tracker <[EMAIL PROTECTED]>

[issue4442] datetime not subclassable in the usual way

2008-11-26 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: This is because datetime does all its initialization in __new__ instead of __init__. -- nosy: +benjamin.peterson priority: -> normal type: -> feature request versions: +Python 2.7, Python 3.1 -Python 2.5

[issue4442] datetime not subclassable in the usual way

2008-11-26 Thread Chris Withers
Chris Withers <[EMAIL PROTECTED]> added the comment: Sorry, forgot to say that the above is at best counterintuitive and not documented anywhere... ___ Python tracker <[EMAIL PROTECTED]> __

[issue4442] datetime not subclassable in the usual way

2008-11-26 Thread Chris Withers
New submission from Chris Withers <[EMAIL PROTECTED]>: >>> from datetime import datetime >>> class defaultdatetime(datetime): ... defaults=(2001,1,1) ... def __init__(self,*args): ... if not args: ... args = self.defaults ... datetime.__init__(self,*args) ... >>> defaultdatetime