[Python-Dev] subclassing builtin data structures (original) (raw)

Guido van Rossum guido at python.org
Fri Feb 13 19:25:15 CET 2015


Are you willing to wait 10 days for an answer? I'm out of round tuits for a while.

On Fri, Feb 13, 2015 at 10:22 AM, Alexander Belopolsky < alexander.belopolsky at gmail.com> wrote:

On Fri, Feb 13, 2015 at 1:19 PM, Alexander Belopolsky <_ _alexander.belopolsky at gmail.com> 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 timone return NotImplemented 39876 gvanrossum [1] http://bugs.python.org/issue2267#msg125979

-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150213/e302b37c/attachment-0001.html>



More information about the Python-Dev mailing list