proposed syntax for multiline anony-functions (hopefully?)
Chris Angelico
rosuav at gmail.com
Thu Aug 21 05:05:20 EDT 2014
On Thu, Aug 21, 2014 at 6:59 PM, <icefapper at gmail.com> wrote:
> thanks, bu what exactly do you find unlikeable in this syntax? the ")" is no new syntax, but simply a match for a previous "("; and you can put it anywhere because the "(" contents are space-insensitive:
>
> this would be a syntax error:
> a = def():
> print("gvr")
>
> this too:
> a = def():
> print("anon")
>
> but not this:
> a = (def():
> print("no")
> )
>
> neither this:
> a = (def():
> print("d"))
>
> nor this:
> a = (def():
> print( "no" )
>
>
> )
>
> yours truly would be glad to know your thoughts on this
I think it's less readable if the close parens goes on the previous
line. However, that's a question of style, more than syntax. I just
think it'd look better with a clear unindent at the end of a block of
statements which all stand alone.
But that was a small side point. What matters is: How is this new
syntax better than out-of-line function definition?
ChrisA
More information about the Python-list
mailing list