On Sat, Jun 29, 2013 at 1:33 PM, Steven D'Aprano
<steve+comp.lang.pyt...@pearwood.info> wrote:
> On Sat, 29 Jun 2013 12:20:45 -0700, cts.private.yahoo wrote:
>> Without wanting to analyze it in too much depth now, I
>> would want a local keyword to allow me to know I was protecting my
>> variables, and a way to specify other scopes, without so much implied
>> scoping in non-intuitive ways...
>
> Huh? What language are you programming in? Python doesn't have implied
> scoping in non-intuitive ways.

def f(x):
    def g(y):
        print(x)
        x = y

Within g, the variable x is implicitly local, which is non-intuitive
since without the assignment it would not be.

That said, while I think a local keyword would not be unwelcome, I
would not want it to be required.  Otherwise we end up with the
scoping rules of Lua, where everything is global unless explicitly
marked as local.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to