What is the proper way to format a multi-line dict in Python?
I use #3. Same for long lists, tuples, etc. It doesn’t require adding any extra spaces beyond the indentations. As always, be consistent. mydict = { “key1”: 1, “key2”: 2, “key3”: 3, } mylist = [ (1, ‘hello’), (2, ‘world’), ] nested = { a: [ (1, ‘a’), (2, ‘b’), ], b: [ (3, ‘c’), … Read more