On 15-02-13, Neil Girdhar  wrote:
> Interesting: 
> http://stackoverflow.com/questions/5490824/should-constructors-comply-with-the-liskov-substitution-principle

You'd better believe I read that thread not 20 minutes ago. :)

> On Fri, Feb 13, 2015 at 3:37 PM, Isaac Schwabacher 
> <alexander.belopol...@gmail.com <ischwabac...@wisc.edu')" 
> target="1">ischwabac...@wisc.edu> wrote:
> 
> > On 15-02-13, Guido van Rossum wrote:
> > > Are you willing to wait 10 days for an answer? I&#39;m out of round tuits 
> > > for a while.
> > 
> > IIUC, the argument is that the Liskov Substitution Principle is a statement 
> > about how objects of a subtype behave relative to objects of a supertype, 
> > and it doesn&#39;t apply to constructors because they aren&#39;t behaviors 
> > of existing objects. So other overriding methods *should* be able to handle 
> > the same inputs that the respective overridden methods do, but constructors 
> > don&#39;t need to. Even though __init__ is written as an instance method, 
> > it seems like it&#39;s "morally" a part of the class method __new__ 
> > that&#39;s only split off for convenience.
> > 
> > If this message is unclear, it&#39;s because I don&#39;t really understand 
> > this myself and I&#39;m trying to articulate my best understanding of 
> > what&#39;s been said on this thread and those it links to.
> > 
> > ijs
> > 
> > > On Fri, Feb 13, 2015 at 10:22 AM, Alexander Belopolsky 
> > > <http://bugs.python.org/issue2267#msg125979(javascript:main.compose('new',
> > >  't=alexander.belopol...@gmail.com>(java_script:main.compose()> wrote:
> > >
> > > >
> > > > On Fri, Feb 13, 2015 at 1:19 PM, Alexander Belopolsky 
> > > > <alexander.belopol...@gmail.com 
> > > > <alexander.belopol...@gmail.com>(java_script:main.compose()> wrote:
> > > > >>
> > > > >> FWIW you&#39;re wrong when you claim that "a constructor is no 
> > > > >> different from any other method". Someone else should probably 
> > > > >> explain this (it&#39;s an old argument that&#39;s been thoroughly 
> > > > >> settled).
> > > > >
> > > > >
> > > > > Well, the best answer I&#39;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] > --Guido van Rossum 
> > > > (python.org/~guido(http://python.org/~guido)(http://python.org/~guido(http://python.org/~guido)))
> > _______________________________________________
> > Python-Dev mailing list
> > Python-Dev@python.org <Python-Dev@python.org>
> > https://mail.python.org/mailman/listinfo/python-dev
> > Unsubscribe: 
> > https://mail.python.org/mailman/options/python-dev/mistersheik%40gmail.com
> >
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
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