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 circumstances, all the current options have a marker that the parser knows about before it encounters the newline. With this new proposal the parser will have to walk an arbitrary number of lines ahead to determine if there are going to be new indexing operations. That won't really work at all in the REPL or any other line-fed interpreter loop.
Currently you can add parentheses to get just about the same visual: (foo["bar"] ["baz"] ["eggs"] ["spam"] = 1) On Tue, May 24, 2022 at 7:44 AM Jan Costandius <jcostand...@gmail.com> 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"] > ["spam"] = 1 > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/TKY4F4SRJEE257AXIJGSZCP3GAGU7YHA/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/FAHKRWABUOYHHVU6R7ZFLKY4IBB6HYTM/ Code of Conduct: http://python.org/psf/codeofconduct/