[issue4442] datetime not subclassable in the usual way

Chris Withers report at bugs.python.org
Wed Nov 26 18:08:02 CET 2008

New submission from Chris Withers <chris at simplistix.co.uk>:

>>> 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()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: function takes at least 3 arguments (0 given)

components: Library (Lib)
messages: 76473
nosy: cjw296
severity: normal
status: open
title: datetime not subclassable in the usual way
versions: Python 2.5

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list