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

[Python-Dev] closure semantics

[Python-Dev] closure semantics [Python-Dev] closure semanticsWalter Dörwald walter at livinglogic.de
Tue Oct 21 19:38:55 EDT 2003
Guido van Rossum wrote:

>>Why not make local variables attributes of the function, i.e.
>>replace:
>>
>>    def inner():
>>       global x in outer
>>       x = 42
>>
>>with:
>>
>>    def inner():
>>       outer.x = 42
> 
> 
> Because this already means something!  outer.x refers to the attribute
> x of function outer.  That's quite different than local variable x of
> the most recent invocation of outer on the current thread's call stack!

I guess unifying them both (somewhat like the instance attribute
lookup rule) won't work.

>>Global variables could then be assigned via:
>>    global.x = 42
> 
> 
> This has a tiny bit of appeal, but not enough to bother.

Bye,
    Walter Dörwald



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