[Python-ideas] Enhance definition of functions
Ethan Furman
ethan at stoneleaf.us
Thu Aug 1 00:02:20 CEST 2013
On 07/30/2013 10:20 PM, Steven D'Aprano wrote:
> On 31/07/13 11:41, Terry Reedy wrote:
>> On 7/30/2013 11:59 AM, Ronald Oussoren wrote:
>>
>>> "Never" is a long time. AFAIK the main reason why Python doesn't have
>>> multi-line lambda's is that nobody has proposed a suitable syntax yet
>>> (and not for lack of trying, the archives of this list and python-dev
>>> contain a lot of proposals that were found lacking).
>>
>> There is also the fact that a generic .__name__ attribute of '<lambda>' is inferior to a possibly unique and
>> meaningful name. This is not just in tracebacks. Consider
>> [<built-in function sin>, <built-in function cos>]
>> versus
>> [<function <lambda> at 0x0000000003470B70>, <function <lambda> at 0x0000000003470BF8>]
>
>
> True, but if we're going to hypothesize nice syntax for multi-line lambdas, it's not much harder to imagine that there's
> also nice syntax to give them a name and a doc string at the same time :-)
We already have nice syntax to assign a name and doc string at the same time -- it's called `def`. ;)
--
~Ethan~
More information about the Python-ideas
mailing list