PBP: 021 Lists

Lists need to be formatted to be readable.  The suggestion is to always use parenthesis, indent after a parenthesis, and line things in columns, all with trailing commas.

The book provides clear examples, which I won’t duplicate here.

I have no problem with this suggestion, and do it almost automatically.  I sometimes don’t think to line things up in columns; the differing number of spaces between things bothers me a little, and I find it tedious to do.  If my editor will Perltidy it that way for me, I won’t object, but I won’t think to do it myself.  (The same is true for lining things up in columns anywhere in code.  It’s a waste of my time.)

I found the “do not do these” examples clear, but have worked with people who suggested them; put the comma first means you can always copy/paste the line and not miss it.  It makes more sense for a language where an unused trailing comma is an error, but is still not worth it.  Use commas as list separators, as we’re used to in English – after the item listed.

Tags:

Leave a Reply