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

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Sep 23 00:13:43 CEST 2011


Paul Moore wrote:

> a = 10
> def foo():
>     a = 20
>     b = static a
> 
> Not allowed might be best, but I suspect it could be hard to
> implement.

Also hard to specify without excluding one of the intended
use cases:

   def foo():
     len = static len

or in the statement version,

   def foo():
     static len = len

I think we'd just have to accept that the RHS is evaluated
outside the function scope, despite being written within
it. That's how static initialisers in C work.

-- 
Greg



More information about the Python-ideas mailing list