Re:WTFPython – Understanding Python through surprising snippets
by gpderetta on Monday December 23, 2019 @11:52AM
(#21864908)
To be fair I missed the note at the end of your commend on my first read. Still, in the specific C++ example, no other capture clause is valid.
Also, python could have chosen a slightly different closure semantics and preserved sanity: instead of closing over the binding itself, it could close over each object reference separately (exactly in the same way the default parameter hack works).
Also, python could have chosen a slightly different closure semantics and preserved sanity: instead of closing over the binding itself, it could close over each object reference separately (exactly in the same way the default parameter hack works).