[Python-ideas] Re: Whitespace handling for indexing

2022-05-24 Thread Steven D'Aprano
There are at least three existing ways to already do this. (foo["bar"] ["baz"] ["eggs"] ["spam"]) = 1 foo["bar"][ "baz"][ "eggs"][ "spam"] = 1 foo["bar"]\ ["baz"]\ ["eggs"]\ ["spam"] = 1 I think the

[Python-ideas] Re: Whitespace handling for indexing

2022-05-24 Thread Benedict Verhegghe
Op 24/05/2022 om 18:46 schreef Chris Angelico: (foo["bar"] ["baz"] ["eggs"] ["spam"] = 1) Not for assignment, unfortunately. And you can't cheat with := either, since only simple names are permitted. This would work: (foo["bar"] ["baz"] ["eggs"] ["spam"])

[Python-ideas] Re: Whitespace handling for indexing

2022-05-24 Thread Chris Angelico
On Wed, 25 May 2022 at 01:08, Jeremiah Paige wrote: > > While that formatting does look nice, this would be a huge change to the > parser just to allow a new formatting style. Right now lines are only > logically joined if they appear between a pair of () [] or {}, or if the line > ends in a

[Python-ideas] Re: Whitespace handling for indexing

2022-05-24 Thread Paul Moore
On Tue, 24 May 2022 at 15:42, Jan Costandius wrote: > > I think that it would be beneficial for PEP 8 conformance, in the case of > large nested dicts, if one were able to separate dict indices by a newline. > What I mean is shown below: > > foo["bar"] > ["baz"] > ["eggs"] >

[Python-ideas] Re: Whitespace handling for indexing

2022-05-24 Thread Jeremiah Paige
While that formatting does look nice, this would be a huge change to the parser just to allow a new formatting style. Right now lines are only logically joined if they appear between a pair of () [] or {}, or if the line ends in a \. Besides the complication of joining lines under new