[Python-ideas] Bring line continuation to multi-level dictionary lookup
abarnert at yahoo.com
Thu Sep 17 08:06:23 CEST 2015
On Sep 16, 2015, at 21:07, John Wong <gokoproject at gmail.com> wrote:
> So here I am, thinking, what if we can do this?
This already has a perfectly valid meaning: you have a list of one string, you're indexing it with another string, and passing the result to a function. If this isn't obvious, try this example:
frobulate(['a', 'e', 'i', 'o', 'u'][vowel])
So, giving it a second meaning would be ambiguous.
Also, there's already a perfectly good way to write what you want. (Actually two, because square brackets continue the exact same way parens do, but I wouldn't recommend that here.)
That looks no uglier than your suggestion, and a lot less ugly when buried inside a larger expression.
(I think it might look nicer to indent the bracketed keys, but I think that technically violates PEP 8.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas