Christian Heimes <[email protected]> added the comment:
You are running in a typical scope issue. The local and global scope of a
lambda work differently than you expect. You can work around the issue by
making fun a local variable:
for name, fun in namefun:
name2fun[name] = lambda x, fun=fun: fun(x)
----------
nosy: +christian.heimes
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45469>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com