[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-13 Thread Peter Ludemann
Chris Angelico wrote: > On Sat, Mar 13, 2021 at 1:46 PM Peter Ludemann peter.ludem...@gmail.com wrote: > > It's not clear to me what surprising behaviors there would be. Javascript > > seems to do OK with optional semicolons - presumably its algorithm is > > similar to what BCPL used. (Or

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Chris Angelico
On Sat, Mar 13, 2021 at 1:46 PM Peter Ludemann wrote: > It's not clear to me what surprising behaviors there would be. Javascript > seems to do OK with optional semicolons - presumably its algorithm is similar > to what BCPL used. (Or perhaps the surprising behaviors are trivial compared > to

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Peter Ludemann
On Fri, 12 Mar 2021 at 18:27, Guido van Rossum wrote: > On Fri, Mar 12, 2021 at 6:23 PM Peter Ludemann > wrote: > >> [I wonder why C didn't adopt BCPL's convention for eliding semi-colons? >> ...] >> > > [Presumably because it caused too many surprising behaviors...] > My guess is that it

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Guido van Rossum
On Fri, Mar 12, 2021 at 6:23 PM Peter Ludemann wrote: > [I wonder why C didn't adopt BCPL's convention for eliding semi-colons? > ...] > [Presumably because it caused too many surprising behaviors...] -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)*

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Peter Ludemann
Guido van Rossum wrote: > Can we skip ahead to considering how to implement this? I can think of two > approaches: either hack the lexer to special-case a newline followed by a > period (which currently can never start a line), or redesign the syntax to > allow NEWLINE INDENT ‘.’ . NEWLINE

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Ethan Furman
On 3/12/21 7:50 AM, Paul Bryan wrote: My inclination would be to cede code formatting to a tool like Black and focus on function: https://black.readthedocs.io/en/stable/ We still have to read it after Black munges it. Like Paul said, add parentheses -- it works for method chaining, string

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread David Mertz
I have written tens of thousands of lines of Pandas code, and I've taught thousands of people to use Pandas. I've worked with the core developers of Pandas as well. This is the first time I've ever seen `\` line continuation used for fluent programming style rather than just using parentheses as

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Guido van Rossum
This argument pretty much kills the proposal. On Fri, Mar 12, 2021 at 9:01 AM Rob Cliffe via Python-ideas < python-ideas@python.org> wrote: > To my mind there are too many differences between running code as a > script and running it in the REPL. This would, presumably, add another > one: the

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Rob Cliffe via Python-ideas
To my mind there are too many differences between running code as a script and running it in the REPL.  This would, presumably, add another one: the initial line would be executed without waiting to see if there is a dot continuation line.  And it just feels wrong to have a complete

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Jonathan Goble
On Fri, Mar 12, 2021 at 10:41 AM Matt Williams wrote: > > Hi, > > It's becoming more popular in Python to have interfaces which are built > around method chaining as a way of applying operations to data. For example > in pandas is moving more towards a default model where methods do not change

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Paul Moore
On Fri, 12 Mar 2021 at 15:53, Paul Bryan wrote: > > My inclination would be to cede code formatting to a tool like Black and > focus on function: > https://black.readthedocs.io/en/stable/ ... and if you try that out, what you'll find is that black adds parentheses: y = ( x.rstrip("\n")

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Guido van Rossum
Can we skip ahead to considering how to implement this? I can think of two approaches: either hack the lexer to special-case a newline followed by a period (which currently can never start a line), or redesign the syntax to allow NEWLINE INDENT ‘.’ . NEWLINE ‘.’ DEDENT at the

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Paul Bryan
My inclination would be to cede code formatting to a tool like Black and focus on function: https://black.readthedocs.io/en/stable/ On Fri, 2021-03-12 at 15:32 +, Matt Williams wrote: > Hi, > > It's becoming more popular in Python to have interfaces which are > built around method chaining