This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients
Date 2004-10-18.06:42:19
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=80475

Under the hood, the compiler is recognizing that the
function bodies are identical and it produces just one code
object instead of two.  Hence, the co_firstline number with
always reflect the first time the code is defined.

A simple demo shows the id being the same when the bodies
are identical:

src = """
f1 = lambda x=1: x
f2 = lambda x=2: x
"""

from dis import dis
c = compile(src, 'example', 'exec')
dis(c)

For the OP's code, the effect can be shown by
differentiating either lambda body by adding zero to the pop
index:
   nextkey1 = lambda N=keynums1,K=key_src: K[N.pop()+0]

I conclude that there is less to the bug than meets the eye
and that it may even be considered a feature.  Referring to
Jeremy for final disposition.
History
Date User Action Args
2007-08-23 14:26:47adminlinkissue1048870 messages
2007-08-23 14:26:47admincreate