[Python-ideas] nonlocal functions
Masklinn
masklinn at masklinn.net
Wed Oct 21 12:45:14 CEST 2009
On 21 Oct 2009, at 12:03 , Carl Johnson wrote:
>
> This is all fantasy, but what is your proposal when this happens:
>
> def foo():
> let a = 1
> stuff
> stuff
> let a = 2 #Oops, forgot about already declaring it!
>
It could be a noop, but I think a warning (or an error if scopes are
statically checked) would be a smarter idea, make the programmer aware
that something weird's happening.
> I also imagine that you won't allow a bare "let a"? Or does it just
> set itself to None?
There's not much sense in a bare `let a` imo, if you want it to be
nothing, just write `let a = None`.
More information about the Python-ideas
mailing list