On Sun, Oct 9, 2016 at 2:25 AM, Steven D'Aprano <st...@pearwood.info> wrote: > On Sat, Oct 08, 2016 at 09:26:13PM +0200, Jelte Fennema wrote: >> I have an idea to improve indenting guidelines for dictionaries for better >> readability: If a value in a dictionary literal is placed on a new line, it >> should have (or at least be allowed to have) a n additional hanging indent. >> >> Below is an example: >> >> mydict = {'mykey': >> 'a very very very very very long value', >> 'secondkey': 'a short value', >> 'thirdkey': 'a very very very ' >> 'long value that continues on the next line', >> } > > Looks good to me, except that my personal preference for the implicit > string concatenation (thirdkey) is to move the space to the > following line, and (if possible) align the parts: > mydict = {'mykey': > 'a very very very very very long value', > 'secondkey': 'a short value', > 'thirdkey': 'a very very very' > ' long value that continues on the next line', > }
Heh--not to bikeshed, but my personal preference is to leave the trailing space on the first line. This is because by the time I've started a new line (and possibly have spent time fussing with indentation for the odd cases that my editor doesn't get quite right) I'll have forgotten that I need to start the line with a space :) Best, Erik _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/