[Python-Dev] Inplace operations for PyLong objects

Antoine Pitrou solipsis at pitrou.net
Sat Sep 2 13:50:39 EDT 2017


On Sat, 2 Sep 2017 10:38:05 -0700
Chris Barker <chris.barker at noaa.gov> wrote:
> On Fri, Sep 1, 2017 at 6:16 PM, Joe Jevnik via Python-Dev <
> python-dev at python.org> wrote:
> 
> > The string concat optimization happens in the interpreter dispatch for
> > INPLACE_ADD
> >  
> 
> In that case, isn't there a new string being build, all in one line of
> python? that is, the string the optimization is being created at that
> point, so the interpreter can know there isn't anything referencing it
> anywhere else.

You can go to the source and check yourself:
https://github.com/python/cpython/blob/master/Python/ceval.c#L5226-L5277

Regards

Antoine.




More information about the Python-Dev mailing list