Dangers of Python Lambda: Repeated Values due to Late Binding
Avoid hidden bugs due to unexpected values in loops with AsyncIO or Multi-threading Python.
There may be a scary secret problem in your use of lambda in Python, when used with AsyncIO or Multi-threading. It is called Late Binding.
The Question
Can you see what is unexpected about below results of the DocTest? By the way, you are familiar with add_done_callback
method, right?
Read more at my blog.