[issue27673] lambda function in loop

2016-08-03 Thread Stefan Rosewig
Stefan Rosewig added the comment: @Emanuel Barry thanks for clarification, I didn't find this when I was searching for. regards Stefan -- ___ Python tracker ___ ___

[issue27673] lambda function in loop

2016-08-03 Thread Emanuel Barry
Emanuel Barry added the comment: This is due to how closures work in Python: they only look up the value of the variable when the function is executed, not when it is created. See the FAQ for more information and how to work around this: https://docs.python.org/3/faq/programming.html#why-do-la

[issue27673] lambda function in loop

2016-08-03 Thread Stefan Rosewig
New submission from Stefan Rosewig: Trying to build tkinter menu dynamically by reading an ini file (configparser) I detect an issue with the lambda function used inside a loop. If the loop variable is used as option in the lambda function, the lambda is not place in time using the current val