[Python-ideas] Before and after the colon in funciton defs.

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Sep 24 01:12:34 CEST 2011

Ron Adam wrote:
> On Fri, 2011-09-23 at 11:11 +1000, Nick Coghlan wrote:
>>Framing the idea that way also suggests a fairly obvious spelling:
>>    def f(x):
>>        nonlocal i=i # Use 'f' as a closure over *itself*
>>        return x + i

Sorry, but that spelling is very far from obvious to me.
According to the current meaning of 'nonlocal', it looks like
a no-op. I don't understand the reasoning that leads from
there to your proposed semantics.

You'll also have to explain how that reasoning applies to
the following variations:

   nonlocal i = i + i
   nonlocal i = i + j
   nonlocal i = j + k


More information about the Python-ideas mailing list