Re: [Python-ideas] Binary arithmetic does not always call subclasses first

2017-04-24 Thread Stephan Hoyer
On Sun, Apr 23, 2017 at 10:57 PM, Greg Ewing wrote: > Stephan Hoyer wrote: > >> In practice, CPython requires that the right operand defines a different >> method before it defers to it. >> > > I'm not sure exactly what the rationale for this behaviour is, > but it's

Re: [Python-ideas] Binary arithmetic does not always call subclasses first

2017-04-24 Thread Stephan Hoyer
+Georg Brandl, in case he remembers where "Move the 3k reST doc tree in place." moved things from: https://github.com/python/cpython/commit/116aa62bf54a39697e25f21d6cf6799f7faa1349 On Mon, Apr 24, 2017 at 4:29 PM, Nick Timkovich wrote: > GitHub shows that that note

Re: [Python-ideas] Binary arithmetic does not always call subclasses first

2017-04-24 Thread Guido van Rossum
If this is portant I should probably ponder it. On Apr 24, 2017 4:47 PM, "Stephan Hoyer" wrote: > +Georg Brandl, in case he remembers where "Move the 3k reST doc tree in > place." moved things from: > https://github.com/python/cpython/commit/116aa62bf54a39697e25f21d6cf679 >

[Python-ideas] Augmented assignment syntax for objects.

2017-04-24 Thread Erik
Hi. I suspect that this may have been discussed to death at some point in the past, but I've done some searching and I didn't come up with much. Apologies if I'm rehashing an old argument ;) I often find myself writing __init__ methods of the form: def __init__(self, foo, bar, baz, spam,

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-24 Thread Chris Angelico
On Tue, Apr 25, 2017 at 11:08 AM, Erik wrote: > The suggestion therefore is: > > def __init__(self, foo, bar, baz, spam, ham): > self .= foo, bar, baz, spam, ham > > This is purely syntactic sugar for the original example: > > def __init__(self, foo, bar, baz, spam,

Re: [Python-ideas] Binary arithmetic does not always call subclasses first

2017-04-24 Thread Nick Timkovich
GitHub shows that that note hasn't changed in 10 years: https://github.com/python/cpython/blame/master/Doc/reference/datamodel.rst#L2210 On Mon, Apr 24, 2017 at 3:15 PM, Terry Reedy wrote: > On 4/24/2017 12:14 PM, Stephan Hoyer wrote: > > Based on the change in the

Re: [Python-ideas] Binary arithmetic does not always call subclasses first

2017-04-24 Thread Terry Reedy
On 4/24/2017 12:14 PM, Stephan Hoyer wrote: Based on the change in the documentation between 2.x and 3.x, I wonder if this is something that someone intended to clean up as part of Python 3000 but never got around to. I would love to hear from anyone familiar with the historical context here.

Re: [Python-ideas] Binary arithmetic does not always call subclasses first

2017-04-24 Thread Steven D'Aprano
On Mon, Apr 24, 2017 at 05:57:17PM +1200, Greg Ewing wrote: > Stephan Hoyer wrote: > >In practice, CPython requires that the > >right operand defines a different method before it defers to it. > > I'm not sure exactly what the rationale for this behaviour is, > but it's probably something along

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-24 Thread Steven D'Aprano
On Tue, Apr 25, 2017 at 02:08:05AM +0100, Erik wrote: > I often find myself writing __init__ methods of the form: > > def __init__(self, foo, bar, baz, spam, ham): > self.foo = foo > self.bar = bar > self.baz = baz > self.spam = spam > self.ham = ham > > This seems a little wordy and

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-24 Thread Nathaniel Smith
On Mon, Apr 24, 2017 at 6:08 PM, Erik wrote: > Hi. I suspect that this may have been discussed to death at some point in > the past, but I've done some searching and I didn't come up with much. > Apologies if I'm rehashing an old argument ;) > > I often find myself