[Python-ideas] Query about proposed Multi-line Anonymous Function syntaxes

Nick Coghlan ncoghlan at gmail.com
Sat Oct 11 00:11:20 CEST 2014


On 11 Oct 2014 04:44, "Guido van Rossum" <guido at python.org> wrote:
>
> On Fri, Oct 10, 2014 at 8:06 AM, Adam Jorgensen <
adam.jorgensen.za at gmail.com> wrote:
>>
>>
>> So, as I understand it, the main reason we don't have multi-line
anonymous functions is because there has been no consensus about
>> the syntax.
>
>
> Well, it's worse -- it's hard to propose a syntax that actually works
without huge changes to the way Python's parser treats indentation: inside
parentheses, indentation is currently *not* significant.
>
>>
>> I was just wondering if someone has a document detailing the various
syntaxes that have been proposed in the the past.
>
>
> No, but there have been many discussions. If you have a taste for mailing
list archaeology it would be nice of you could dig up the various threads
and summarize them for posterity, so at least we might make progress rather
than going around in circles.

There's also my 3 different documented suggestions aimed at this problem
space:

PEP 403 (overriding the name binding step for function and class
definitions): http://www.python.org/dev/peps/pep-0403/

PEP 3150 (forward references to a trailing statement local namespace):
http://www.python.org/dev/peps/pep-3150/

Suite expressions:
http://python-notes.curiousefficiency.org/en/latest/pep_ideas/suite_expr.html

The main stumbling block for all of them isn't getting agreement on syntax
as such, but rather finding compelling examples that can't already be
written more clearly by refactoring them to remove the need for a
multi-line inline function. I don't have such examples myself, which is why
both PEPs are deferred, and the last idea was never even submitted in the
first place.

Without such compelling examples, it's hard to judge the value of the
syntax proposals themselves, as it's difficult to counter the "well, don't
write it like that" argument.

I asked various folks at SciPy earlier this year to look into coming up
with such examples (as that was one of the best aspects of the matrix
multiplication PEP), but haven't heard anything back as yet.

Regards,
Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20141011/3188e2f1/attachment-0001.html>


More information about the Python-ideas mailing list