A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/039566.html below:

[Python-Dev] replacing 'global'

[Python-Dev] replacing 'global'Aahz aahz at pythoncraft.com
Sun Oct 26 10:46:26 EST 2003
On Sun, Oct 26, 2003, Alex Martelli wrote:
>
> Keeping := Franciscan in its simplicity would make it easiest to
> implement, easiest to explain, AND avoid all sort of confusing cases
> where the distinction between := and = would otherwise be confusingly
> nonexistent.  It would also make it most effective because it always
> means the same thing -- "assignment to (already-existing) nonlocal".
> This is much the spirit in which I'd forego the idea of making += etc
> access nonlocals too, though I guess I'm only -0 on that; it seems
> simplest and most effective to have the one concept "rebinding a
> nonlocal name" correspond in strict 1-1 way to the one notation := .
> Simplicity and effectiveness feel very Pythonic to me.

Sounds good to me.  Question: what does this do?

    def f():
        def g(x):
            z := x
        g(3)
        print z
        return g
    g = f()
    print z
    g('foo')
    print z

That is, in the absence of a pre-existing binding, where does the
binding for := go?  I think it should be equivalent to global, going to
the module scope.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4