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
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 never return NotImplemented (because you have to pretty

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

2015-05-14 Thread Guido van Rossum
I expect you can make something that behaves like list by defining __mul__ and __rmul__ and returning NotImplemented. On Thursday, May 14, 2015, Stefan Richthofer wrote: > >>Should I be worried? > > You mean should *I* be worried ;) > > Stuff like this is highly relevant for JyNI, so thanks very

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

2015-05-14 Thread Stefan Richthofer
>>Should I be worried? You mean should *I* be worried ;) Stuff like this is highly relevant for JyNI, so thanks very much for clarifying this subtle behavior. It went onto my todo-list right now to ensure that JyNI will emulate this behavior as soon as I am done with gc-support. (Hopefully it w