[Python-ideas] Anonymous blocks (again):
Terry Jan Reedy
tjreedy at udel.edu
Mon May 13 18:28:40 CEST 2013
On 5/13/2013 11:40 AM, Juancarlo Añez wrote:
> The above works perfectly defining a function for the embedded
> expression using a synthetic name, like "c123", and passing it to closure():
>
> def c123():
> match_this()
> match_that()
>
> closure(c123)
>
>
> My quest is because the above seems quite unpythonic.
I disagree that the above is unpythonic. In Python, functions are
objects like everything else. Define them, pass them to functions, like
anything else. 'Unpythonic' is treating functions as special, other than
that they are called (have a call method).
Terry
More information about the Python-ideas
mailing list