[issue2267] datetime.datetime operator methods are not subclass-friendly

Paul Komkoff report at bugs.python.org
Mon Mar 10 20:09:55 CET 2008


New submission from Paul Komkoff <theraphim at gmail.com>:

The datetime.datetime class overrides some arithmetic operations for it
to be able to add or subtract timedeltas. However, the result of A + B
operation, where A is instance of a subclass of datetime and B is
timedelta instance will be always the instance of base datetime.

This is extremely annoying and requires to override arithmetic operators
and writing a lots of rubbish to replace the datetime base object with
type(self)

----------
components: Library (Lib)
messages: 63446
nosy: stingray
severity: normal
status: open
title: datetime.datetime operator methods are not subclass-friendly
type: behavior
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2267>
__________________________________


More information about the Python-bugs-list mailing list