[Tutor] Globals?

Kent Johnson kent37 at tds.net
Sun Nov 14 02:53:21 CET 2004


Lloyd Kvam wrote:
> Well, the behavior that you are looking for is quite deliberately not
> supported in Python.  I would have described closures as allowing you to
> set policy for future execution.  A decision can be made once and then
> packaged as a piece of executable code which is used else where.  
> 
> I gather that closure purists would expect that code to have the ability
> to also rebind variables that lie outside of that executable block.

That's my understanding of the issue. Here are a couple of references:
http://groups.google.com/groups?hl=en&lr=&c2coff=1&selm=tyfwu15v85j.fsf%40pcepsft001.cern.ch
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/67666

This page has orbitz' CL example and a Python version using a class 
whose instance is callable.
http://www.paulgraham.com/accgen.html

Kent


More information about the Tutor mailing list