Closures in python

Hallvard B Furuseth (nospam nospam) h.b.furuseth at usit.uio.no
Sun Sep 21 16:33:45 EDT 2003


JCM wrote:
>   >>> def foo():
>   ...   x = [3]
>   ...   def bar():
>   ...     x[0] += 1
>   (...)
> 
> This is actually one of my biggest complaints about Python.  I'd like
> syntactic disambiguation between definition and assignment in order to
> have control over which scope you're assigning into.

Maybe Python could be changed to let 'foo.x' inside function foo mean
the x variable in foo?

-- 
Hallvard




More information about the Python-list mailing list