[Python-ideas] Extending expressions using ellipsis
Joonas Liik
liik.joonas at gmail.com
Thu Sep 1 03:43:17 EDT 2016
On 1 September 2016 at 09:40, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>>
>> Would this be enforced in the grammar or by the lexer? Since you say
>> you expect the indentation to be enforced, that suggests it would be
>> done by the grammar,
>
>
> I think it could be done by having the lexer enter a mode
> where it swallows a newline that is followed by an indentation
> to a level greater than the starting level of the construct.
> Then no change would be needed to the grammar.
>
> --
> Greg
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
Not sure if this is a good idea but it might also make some sense to
in stead have an operator at the beginning of the line
for example some languages have a chainging operator for method calls:
my_object.m1()
..m2()
being equivalent to
my_object.m1()
my_object.m2()
It could also be possible to have a special
swallow-the-preceding-newline operator or something of that effect.
side note: the chainging operator does not work on the return value of
the method thus the method no longer has to choose between returning
useful info or `this` for chaining convenience.
More information about the Python-ideas
mailing list