[Python-3000] Line continuation using ellipsis
Andrew Koenig
ark-mlist at att.net
Fri Apr 13 21:07:41 CEST 2007
> I'm not proposing to remove the feature, however I'd like to see an
> alternative method for declaring statements that cross a line boundary.
> I seem to recall at one point someone suggesting the use of ellipsis,
> which makes a lot of sense to me:
>
> sorted_result = partition_lower( input_list, pivot ) ...
> + pivot ...
> + partition_upper( input_list, pivot )
I once used a programming language named EFL that had what I think is a nice
convention: If the last token on a line is an operator (i.e. something that
cannot syntactically be the last token of a statement), the next line is
deemed a continuation. So your example would be able to be written this
way:
sorted_result = partition_lower( input_list, pivot) +
pivot +
partition_upper( input_list, pivot )
Interestingly, if I remember correctly, EFL did *not* assume a continuation
for unmatched parentheses -- it looked only at the last token on the line.
For Python, I guess I'd like it if either unmatched parentheses or ending
with an operator were to signal continuation.
More information about the Python-3000
mailing list