Re: [Python-Dev] subclassing builtin data structures

2015年2月13日 10:24:52 -0800

On Fri, Feb 13, 2015 at 1:19 PM, Alexander Belopolsky <
[email protected]> wrote:
>>
>> FWIW you're wrong when you claim that "a constructor is no different
from any other method". Someone else should probably explain this (it's an
old argument that's been thoroughly settled).
>
>
> Well, the best answer I've got in the past [1] was "ask on python-dev
since Guido called the operator overriding expectation." :-)
And let me repost this bit of history [1]:
Here is the annotated pre-r82065 code:
 39876 gvanrossum def __add__(self, other):
 39876 gvanrossum if isinstance(other, timedelta):
 39928 gvanrossum return self.__class__(self.__days +
other.__days,
 39876 gvanrossum self.__seconds +
other.__seconds,
 39876 gvanrossum self.__microseconds +
other.__microseconds)
 40207 tim_one return NotImplemented
 39876 gvanrossum
[1] http://bugs.python.org/issue2267#msg125979
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to