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 +--------------------------------------+
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