[Python-Dev] Re: Understanding why object defines rich comparison methods

2020-09-23 Thread Serhiy Storchaka
23.09.20 03:05, Greg Ewing пише: > On 23/09/20 12:20 am, Steven D'Aprano wrote: >> Presumably back when rich comparisons were added, the choice would have >> been: >> >> - add one tp_richcompare slot to support all six methods; or >> >> - add six slots, one for each individual dunder >> >> in which

[Python-Dev] Re: Tagged pointer experiment: need help to optimize

2020-09-23 Thread Ivan Levkivskyi
On Wed, 23 Sep 2020 at 01:19, Guido van Rossum wrote: > On Tue, Sep 22, 2020 at 4:58 PM Greg Ewing > wrote: > >> What are you trying to achieve by using tagged pointers? >> >> It seems to me that in a dynamic environment like Python, tagged >> pointer tricks are only ever going to reduce memory

[Python-Dev] Re: Tagged pointer experiment: need help to optimize

2020-09-23 Thread Mark Shannon
On 23/09/2020 9:47 am, Ivan Levkivskyi wrote: On Wed, 23 Sep 2020 at 01:19, Guido van Rossum > wrote: On Tue, Sep 22, 2020 at 4:58 PM Greg Ewing mailto:greg.ew...@canterbury.ac.nz>> wrote: What are you trying to achieve by using tagged pointers?

[Python-Dev] Re: Tagged pointer experiment: need help to optimize

2020-09-23 Thread Victor Stinner
Le mer. 23 sept. 2020 à 10:48, Ivan Levkivskyi a écrit : > // offtopic below, sorry > > In general, I think any significant perf wins will require some static info > given to the Python compiler. I was thinking a long while ago about defining > some kind of a standard protocol so that static typ

[Python-Dev] Re: Tagged pointer experiment: need help to optimize

2020-09-23 Thread Ivan Levkivskyi
On Wed, 23 Sep 2020 at 11:42, Mark Shannon wrote: > > > On 23/09/2020 9:47 am, Ivan Levkivskyi wrote: > > > > > > On Wed, 23 Sep 2020 at 01:19, Guido van Rossum > > wrote: > > > > On Tue, Sep 22, 2020 at 4:58 PM Greg Ewing > > mailto:greg.ew...@canterbury.ac.nz>>

[Python-Dev] Re: Tagged pointer experiment: need help to optimize

2020-09-23 Thread Victor Stinner
Le mer. 23 sept. 2020 à 13:49, Ivan Levkivskyi a écrit : > Sure, but JIT optimizations assume there are some "hot spots" in the code > where e.g. a function is called in a loop, so that type information can be > gathered and re-used. > The problem is that in my experience there are many applicat

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-09-23 Thread Jens Gåsemyr Magnus via Python-Dev
It would be fantastic if these were expressions rather than statements. Imagine being able to write things like: ```python @memoized def fibonacci(n): match n: case 0: (return/yield?) 0 case 1: 1 case _: fibonacci(n - 2) + fibonacci(

[Python-Dev] Re: Tagged pointer experiment: need help to optimize

2020-09-23 Thread Mark Shannon
On 23/09/2020 12:46 pm, Ivan Levkivskyi wrote: On Wed, 23 Sep 2020 at 11:42, Mark Shannon > wrote: On 23/09/2020 9:47 am, Ivan Levkivskyi wrote: > > > On Wed, 23 Sep 2020 at 01:19, Guido van Rossum mailto:gu...@python.org> >

[Python-Dev] Re: unable to create PR on github

2020-09-23 Thread Mats Wichmann
On 9/22/20 1:20 AM, Antoine Pitrou wrote: > On Mon, 21 Sep 2020 20:56:18 -0700 > Ethan Furman wrote: >> And even more data: >> >> I added a body to the PR I was originally having trouble with: >>button stayed gray >> >> I went away for a while, say 5 - 10 minutes, and when I went back to >> t

[Python-Dev] Re: Tagged pointer experiment: need help to optimize

2020-09-23 Thread Antoine Pitrou
On Tue, 22 Sep 2020 17:11:40 -0700 Guido van Rossum wrote: > On Tue, Sep 22, 2020 at 4:58 PM Greg Ewing > wrote: > > > What are you trying to achieve by using tagged pointers? > > > > It seems to me that in a dynamic environment like Python, tagged > > pointer tricks are only ever going to redu

[Python-Dev] Re: Tagged pointer experiment: need help to optimize

2020-09-23 Thread Antoine Pitrou
On Wed, 23 Sep 2020 12:46:25 +0100 Ivan Levkivskyi wrote: > > Another thing is that making CPython itself JITted may be even harder than > adding some (opt-in) static based optimizations, but > I am clearly biased here. > > Actually what would be really cool is having both: i.e. have a JIT that

[Python-Dev] Re: Understanding why object defines rich comparison methods

2020-09-23 Thread Jeff Allen
On 22/09/2020 12:13, Serhiy Storchaka wrote: Because object.__eq__ and object.__ne__ exist. I didn't quite get the logic of this. In case anyone (not Steven) is still puzzled as I was, I think one could say: ... because tp_richcompare is filled, *so that* object.__eq__ and object.__ne__ will