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

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Sep 29 23:36:13 CEST 2011

Paul Moore wrote:
> On 29 September 2011 14:30, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>   @nonlocal(n=0, lock=threading.Lock())
>>   def global_counter():
>>       with lock:
>>           n += 1
>>           return n
> The above says to me "the following
> values are nonlocal to this function",

It still has the problem that the *visibility* is *local*,
directly contradicting what the keyword says.


More information about the Python-ideas mailing list