[Python-ideas] Tweaking closures and lexical scoping to include the function being defined

Carl Matthew Johnson cmjohnson.mailinglist at gmail.com
Sun Oct 2 08:43:38 CEST 2011


On Oct 1, 2011, at 8:29 PM, Ron Adam wrote:
> 
> How about a name space literal? ie.. a dictionary.
> 
>    def global_counter(x) {n:0, lock=lock}:
>        with lock:
>            n += 1
>            yield n

Yeah, but it would break this existing code:

from __future__ import braces



More information about the Python-ideas mailing list