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/039550.html below:

[Python-Dev] replacing 'global'

[Python-Dev] replacing 'global'Just van Rossum just at letterror.com
Sun Oct 26 06:14:58 EST 2003
Skip Montanaro wrote:

> I see a couple problems:
> 
> * Would you be required to use := at each assignment or just the
> first?

Just the first; "a = 2" still means "a is local to this scope".

> All the toy examples we pass around are very simple, but it
> seems that the name would get assigned to more than once, so the
> programmer might need to remember the same discipline all the time. 
> It seems that use of
>         x := 2
>       and
>         x = 4
> should be disallowed in the same function so that the compiler can
> flag such mistakes.

I don't see it as a mistake. := would mean: "bind to whichever scope the
name is defined in", and that includes the current scope. I disagree
with Alex when he says := should mean "I'm binding this name in
NON-local scope".

> * This seems like a statement which mixes declaration and execution.

How is that different from "regular" assignment? It mixes declaration
and execution in the same way.

Just

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