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 mark.dickinson
Recipients mark.dickinson, r.david.murray, rhettinger, rmalouf
Date 2015-11-02.19:13:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446491631.33.0.76367364142.issue25535@psf.upfronthosting.co.za>
In-reply-to
Content
Relevant post from Tim Peters back in 2005, on the subject of subclassing datetime and timedelta:

"""
Yes, and all builtin Python types work that way.  For example,
int.__add__ or float.__add__ applied to a subclass of int or float
will return an int or float; similarly for a subclass of str.  This
was Guido's decision, based on that an implementation of any method in
a base class has no idea what requirements may exist for invoking a
subclass's constructor.  For example, a subclass may restrict the
values of constructor arguments, or require more arguments than a base
class constructor; it may permute the order of positional arguments in
the base class constructor; it may even be "a feature" that a subclass
constructor gives a different meaning to an argument it shares with
the base class constructor.  Since there isn't a way to guess, Python
does a safe thing instead.
"""

Source: https://mail.python.org/pipermail/python-list/2005-January/311610.html
History
Date User Action Args
2015-11-02 19:13:51mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, r.david.murray, rmalouf
2015-11-02 19:13:51mark.dickinsonsetmessageid: <1446491631.33.0.76367364142.issue25535@psf.upfronthosting.co.za>
2015-11-02 19:13:51mark.dickinsonlinkissue25535 messages
2015-11-02 19:13:51mark.dickinsoncreate