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

[Python-Dev] Re: closure semantics

[Python-Dev] Re: closure semantics [Python-Dev] Re: closure semanticsGreg Ewing greg at cosc.canterbury.ac.nz
Wed Oct 22 20:15:48 EDT 2003
Guido:

> My problem with the nested functions is that it is much harder to get
> a grasp of what the shared state is -- any local variable in the outer
> function *could* be part of the shared state, and the only way to tell
> for sure is by inspecting all the subfunctions.

That would be solved if, instead of marking variables
in inner scopes that refer to outer scopes, it were
the other way round, and variables in the outer scope
were marked as being rebindable in inner scopes.

  def f():
    rebindable x
    def inc_x_by(i):
      x += i # rebinds outer x
    x = 39
    inc_x_by(3)
    return x

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+

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