Re: [Python-Dev] Python-versus-CPython question for __mul__ dispatch

2015-05-19 Thread Kevin Modzelewski
We have a similar experience -- Pyston runs into a similar issue with sqlalchemy (with "str() + foo" calling foo.__radd__ before str.sq_concat) and we are working to match CPython's behavior. On Tue, May 19, 2015 at 7:00 AM, Armin Rigo wrote: > Hi Nick, > > On 16 May 2015 at 10:31, Nick Coghlan

Re: [Python-Dev] Python-versus-CPython question for __mul__ dispatch

2015-05-19 Thread Armin Rigo
Hi Nick, On 16 May 2015 at 10:31, Nick Coghlan wrote: > Oh, that's rather annoying that the PyPy team implemented bug-for-bug > compatibility there, and didn't follow up on the operand precedence > bug report to say that they had done so. It's sadly not the only place, by far, where a behavior o

Re: [Python-Dev] Python-versus-CPython question for __mul__ dispatch

2015-05-17 Thread Nathaniel Smith
On Sat, May 16, 2015 at 1:31 AM, Nick Coghlan wrote: > On 16 May 2015 at 07:35, Nathaniel Smith wrote: >> On Thu, May 14, 2015 at 11:53 PM, Nathaniel Smith wrote: >>> On Thu, May 14, 2015 at 9:29 PM, Guido van Rossum wrote: I expect you can make something that behaves like list by defining

Re: [Python-Dev] Python-versus-CPython question for __mul__ dispatch

2015-05-16 Thread Nick Coghlan
On 16 May 2015 at 07:35, Nathaniel Smith wrote: > On Thu, May 14, 2015 at 11:53 PM, Nathaniel Smith wrote: >> On Thu, May 14, 2015 at 9:29 PM, Guido van Rossum wrote: >>> I expect you can make something that behaves like list by defining __mul__ >>> and __rmul__ and returning NotImplemented. >>

Re: [Python-Dev] Python-versus-CPython question for __mul__ dispatch

2015-05-16 Thread Nick Coghlan
On 15 May 2015 at 16:53, Nathaniel Smith wrote: > On Thu, May 14, 2015 at 9:29 PM, Guido van Rossum wrote: >> I expect you can make something that behaves like list by defining __mul__ >> and __rmul__ and returning NotImplemented. > > Hmm, it's fairly tricky, and part of the trick is that you can

Re: [Python-Dev] Python-versus-CPython question for __mul__ dispatch

2015-05-16 Thread Nick Coghlan
On 15 May 2015 at 10:45, Nathaniel Smith wrote: > Hi all, > > While attempting to clean up some of the more squamous aspects of > numpy's operator dispatch code [1][2], I've encountered a situation > where the semantics we want and are using are possible according to > CPython-the-interpreter, but

Re: [Python-Dev] Python-versus-CPython question for __mul__ dispatch

2015-05-15 Thread Nathaniel Smith
On Thu, May 14, 2015 at 11:53 PM, Nathaniel Smith wrote: > On Thu, May 14, 2015 at 9:29 PM, Guido van Rossum wrote: >> I expect you can make something that behaves like list by defining __mul__ >> and __rmul__ and returning NotImplemented. > > Hmm, it's fairly tricky, and part of the trick is tha

Re: [Python-Dev] Python-versus-CPython question for __mul__ dispatch

2015-05-14 Thread Nathaniel Smith
ntially will save me a lot of time. >> >> So, everybody please feel encouraged to post things like this as they come >> up. Maybe >> there could be kind of a pitfalls-page somewhere in the docs collecting >> these things. >> >> Best >> >> Stefan &

Re: [Python-Dev] Python-versus-CPython question for __mul__ dispatch

2015-05-14 Thread Guido van Rossum
se things. > > Best > > Stefan > > > > Gesendet: Freitag, 15. Mai 2015 um 02:45 Uhr > > Von: "Nathaniel Smith" > > > An: "Python Dev" > > > Betreff: [Python-Dev] Python-versus-CPython question for __mul__ dispatch > > >

Re: [Python-Dev] Python-versus-CPython question for __mul__ dispatch

2015-05-14 Thread Stefan Richthofer
a pitfalls-page somewhere in the docs collecting these things. Best Stefan > Gesendet: Freitag, 15. Mai 2015 um 02:45 Uhr > Von: "Nathaniel Smith" > An: "Python Dev" > Betreff: [Python-Dev] Python-versus-CPython question for __mul__ dispatch > > Hi all, >

[Python-Dev] Python-versus-CPython question for __mul__ dispatch

2015-05-14 Thread Nathaniel Smith
Hi all, While attempting to clean up some of the more squamous aspects of numpy's operator dispatch code [1][2], I've encountered a situation where the semantics we want and are using are possible according to CPython-the-interpreter, but AFAICT ought not to be possible according to Python-the-lan