[Python-Dev] code blocks using 'for' loops and generators
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Mar 17 02:14:48 CET 2005
Samuele Pedroni wrote:
> well, I think some people desire a more streamlined way of writing code
> like:
>
> def f(...)
> ...
> def g(...)
> ...
> x = h(...,f,g)
Using the recently-proposed 'where' facility, this could
be written
x = h(..., f, g) where:
def f(...):
...
def g(...):
...
> Of course if the functions then are
> allowed to change the surrounding bindings this could be used for
> resource release issues etc.
Yes, rebinding in the surrounding scope is the one thing
that style wouldn't give you
--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg.ewing at canterbury.ac.nz +--------------------------------------+
More information about the Python-Dev
mailing list