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

2013-01-12 Thread Mark Dickinson
Mark Dickinson added the comment: Alexander: can this be closed as wont fix? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2267 ___ ___

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

2013-01-12 Thread Alexander Belopolsky
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2267 ___

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

2013-01-11 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: -- nosy: -brett.cannon versions: +Python 3.4 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2267 ___

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

2011-01-10 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Note that before r82065, python prototype, now available as Lib/datetime.py had binary operations implemented to return subclass instances. Here is annotated pre-r82065 code: 39876 gvanrossum def __add__(self,

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

2010-06-17 Thread Brett Cannon
Brett Cannon br...@python.org added the comment: There is a difference between methods and overridden operators (slightly) in terms of cognitive understanding. I mean creating a new instance from a timestamp seems like an operation on the object by the object. Addition, though, seems like a

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

2010-06-17 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: I had understood that the rule was that alternate constructors should be classmethods, for consistency with __new__. (Well, except that __new__ is actually a staticmethod, of course... ) E.g., after class MyDecimal(Decimal): pass,

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

2010-06-09 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I would like to take another shot at this. The link in Amaury's closing comment no longer works, so here is the relevant post: Returning same type as self for arithmetic in subclasses Tim Peters tim.peters at gmail.com

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

2010-06-09 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: If you want to challenge Guido's design decision, I think python-dev would be the place to do it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2267

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

2010-06-09 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: If you want to challenge Guido's design decision, I think python-dev would be the place to do it. Do you have a link supporting that it was Guido's design decision? This decision must have been made around class/type

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

2010-06-09 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Do you have a link [...] Nope. Just going on Tim's description of it as Guido's decision. I've no idea of the history, and I don't particularly recall any recent relevant python-dev discussions. --

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

2008-03-10 Thread Paul Komkoff
New submission from Paul Komkoff [EMAIL PROTECTED]: 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

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

2008-03-10 Thread Alexander Belopolsky
Alexander Belopolsky [EMAIL PROTECTED] added the comment: This is trivial to implement (see attached) and IMHO is a good idea. The next question, however is whether similar changes should be made to timedelta arithmetics. Timedelta case is not so clearcut because of the usual dilemma of what

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

2008-03-10 Thread Paul Komkoff
Paul Komkoff [EMAIL PROTECTED] added the comment: I just checked the astimezone method - it also does this. As with timedelta... well, it's not critical for me now but it worth thinking about :) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2267

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

2008-03-10 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment: Recently, the similar issue1562 Decimal can't be subclassed useful was rejected. In the discussion I found a reference to a former post, which precisely deals with datetime and timedelta:

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

2008-03-10 Thread Alexander Belopolsky
Alexander Belopolsky [EMAIL PROTECTED] added the comment: 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