Multi-line lambda proposal.

Terry Reedy tjreedy at udel.edu
Thu May 11 13:44:50 EDT 2006


"Kaz Kylheku" <kkylheku at gmail.com> wrote in message 
news:1147366331.637492.129980 at i39g2000cwa.googlegroups.com...
> Let me make the observation that  name of an inner function is, alone,
> insufficient to identify that function in a debugging scenario. If you
> have some inner function called I, defined within function F, you need
> to know that it's the I inside F, and not some other I.
>
> Look at what happens with:
>
>>>> def err():
> ...   def inner():
> ...     return nonexistent
> ...   return inner
> ...
>>>> err()
> <function inner at 0x8177304>
>>>> err()()
> Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>  File "<stdin>", line 3, in inner
> NameError: global name 'nonexistent' is not defined

So name it err_inner.  Or _err.

tjr






More information about the Python-list mailing list