Christopher Allan Webber at 2015-10-17T00:58:55Z

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
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 like this.

Ah! Okay that's helpful :)

Christopher Allan Webber at 2015-10-17T13:27:29Z