
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@cosc.canterbury.ac.nz +--------------------------------------+