
Using lists as fake value boxes in python because python doesn't know how to lexical scope
Gergely Nagy likes this.
Claes Wallin (韋嘉誠), Claes Wallin (韋嘉誠), Olivier Mehani, Olivier Mehani and 1 others shared this.
Show all 6 replies



This is also why implementing let in Hy is so complex.

Python 3 has the 'nonlocal' keyword that does exactly what you want (if you inserted "nonlocal x" as the first line of _func(), it would do the right thing)... but, well, you don't get it unless you switch to Python 3.
Screwtape at 2015-10-17T08:02:19Z
Claes Wallin (韋嘉誠), Christopher Allan Webber, lnxwalt@microca.st likes this.

@Christopher Allan Webber Thank you for the thorough explanation!
Charles Stanhope at 2015-10-17T15:04:41Z
lnxwalt@microca.st likes this.