nested scopes in IDLE? (2.1)
urner at alumni.princeton.edu
Mon Jun 4 06:55:42 CEST 2001
I can get the nested scopes feature to work in
modules of course, using the
from __future__ import nested_scopes
thing, but if I just boot IDLE and try to write
the following compose function, it errors out:
return lambda f,g,x: f(g(x))
There's the old workaround from pre-nested scopes
"""with thanks to Dustin Mitchell"""
return lambda _f=f,_g=g,x: _f(_g(x))
but that's what we want to get away from, and do,
in 2.1 -- but apparently not when entering defs
interactively in IDLE (vs. in saved .py files).
>>> from __future__ import nested_scopes
in IDLE has no effect because we're already into
it too far by that time (whatever that means) i.e.
this statement has to happen at "the top". Perhaps
there's a source code tweek I could make to my
IDLE which includes the nested scopes feature by
CC by email please: pdx4d at teleport.com or the above
More information about the Python-list