[Python-Dev] replacing 'global'

Alex Martelli aleaxit at yahoo.com
Sun Oct 26 06:35:41 EST 2003


On Sunday 26 October 2003 11:42, Skip Montanaro wrote:
   ...
> 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 entirely agree with you.  There is no good use case that I can see for
this mixture, and prohibiting it helps the compiler help the programmer.


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

That's actually the PLAIN assignment statement, which mixes assigning
a value with telling the compiler "this name is local" (other binding 
statements such as def, class etc also do that).


Alex





More information about the Python-Dev mailing list