Author Aaron Hall
Recipients Aaron Hall, rhettinger, serhiy.storchaka, terry.reedy
Date 2017-10-17.21:01:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
New information: I think I have pinpointed at least a contributor to the difference - closure lookups seem to be currently slightly slower (by a few percent) than global lookups (see 

And as we can see, an inner function that references itself is a closure on itself (see LOAD_DEREF):

>>> def foo():
...     def bar():
...         return bar
...     return bar
>>> bar = foo()
>>> import dis
>>> dis.dis(bar)
  3           0 LOAD_DEREF               0 (bar)
              2 RETURN_VALUE

This, at least to me, explains why the performance difference doesn't completely amortize away.
Date User Action Args
2017-10-17 21:01:50Aaron Hallsetrecipients: + Aaron Hall, rhettinger, terry.reedy, serhiy.storchaka
2017-10-17 21:01:50Aaron Hallsetmessageid: <>
2017-10-17 21:01:50Aaron Halllinkissue31753 messages
2017-10-17 21:01:50Aaron Hallcreate