photuris
8/31/2016 - 6:11 PM

What's the best PEP-8 practice for accessing nested dictionaries on multiple lines?

What's the best PEP-8 practice for accessing nested dictionaries on multiple lines?

# snip...
        # PyLint complains: C0330 Wrong continued identation.
        result_set = (results_report['Results']
                                    ['Metadata']
                                    ['FooBarDefinitions']
                                    ['BazBatDefinition'])

        # Flake8 complains: E211 - whitespace before '['
        result_set = results_report['Results'] \
                                   ['Metadata'] \
                                   ['FooBarDefinitions'] \
                                   ['BazBatDefinition']