Tail recursion to while iteration in 2 easy steps

random832 at fastmail.us random832 at fastmail.us
Thu Oct 3 10:16:29 EDT 2013


On Wed, Oct 2, 2013, at 22:34, Steven D'Aprano wrote:
> You are both assuming that LOAD_CONST will re-use the same tuple 
> (1, 2, 3) in multiple places. But that's not the case, as a simple test 
> will show you:

>>> def f():
...   return (1, 2, 3)
>>> f() is f()
True

It does, in fact, re-use it when it is _the same LOAD_CONST
instruction_.



More information about the Python-list mailing list