@@ -121,6 +121,51 @@ Optional::
121
121
var_one, var_two,
122
122
var_three, var_four)
123
123
124
+ For dictionaries there is an extra rule. When placing a dictionary key on a new
125
+ line an additional hanging indent should be added. This is so it is easy to
126
+ differentiate between keys and values.
127
+
128
+ Yes::
129
+
130
+ # Keys alligned with opening delimiter, values have an extra indent
131
+ mydict = {'firstkey':
132
+ 'a very very very very very long value',
133
+ 'secondkey': 'a short value',
134
+ 'thirdkey': 'a very very very'
135
+ ' long value that continues on the next line'
136
+ ' and even on the line after that.',
137
+ }
138
+
139
+ # Keys one and values with two hanging indents
140
+ mydict = {
141
+ 'firstkey':
142
+ 'a very very very very very long value',
143
+ 'secondkey': 'a short value',
144
+ 'thirdkey': 'a very very very'
145
+ ' long value that continues on the next line'
146
+ ' and even on the line after that.',
147
+ }
148
+
149
+ # Continuing value indented to column where the value starts
150
+ mydict = {
151
+ 'thirdkey': 'a very very very'
152
+ ' long value that continues on the next line'
153
+ ' and even on the line after that.',
154
+ }
155
+
156
+
157
+ No::
158
+
159
+ # Keys and values indented in the same way.
160
+ mydict = {'firstkey':
161
+ 'a very very very very very long value',
162
+ 'secondkey': 'a short value',
163
+ 'thirdkey': 'a very very very'
164
+ ' long value that continues on the next line',
165
+ ' and even on the line after that.'
166
+ }
167
+
168
+
124
169
.. _`multiline if-statements`:
125
170
126
171
When the conditional part of an ``if``-statement is long enough to require
0 commit comments