[Python-ideas] Bring line continuation to multi-level dictionary lookup
John Wong
gokoproject at gmail.com
Fri Sep 18 16:44:27 CEST 2015
On Thu, Sep 17, 2015 at 2:06 AM, Andrew Barnert <abarnert at yahoo.com> wrote:
> 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?
>
> response(
> ["DescribeDBSnapshotsResponse"]
> ["DescribeDBSnapshotsResult"]
> )
>
>
> 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.
>
Great catch... I did not even consider this. You are right.
> 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.)
>
> (response
> ["DescribeDBSnapshotsResponse"]
> ["DescribeDBSnapshotsResult"]
> )
>
Thank you all. I think I should have noticed (response[..]) would work...
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150918/24f15c61/attachment.html>
More information about the Python-ideas
mailing list