Strange location for a comma

Tim Chase python.list at tim.thechases.com
Thu Sep 3 10:36:23 EDT 2015


On 2015-09-03 14:48, Peter Otten wrote:
> The only reason I see to add an extra comma are smaller and easier
> to read diffs when you make a change:

While that's the primary reason I do it, it's also helpful if you
have a bunch of named keyword arguments and want sort/rearrange them
(usually for clarity/grouping). You don't have to worry about finding
the previous-last-item and adding a comma to it and then finding the
new-last-item and removing its comma.  Also, when adding a new
item, you can just copy an existing line, paste it, and modify the
salient parts without needing to append a comma to one line or
delete it from the pasted line.

But the improvement in diff output?  That's a big win for me.

I notice it most when I *can't* use it, like in writing SQL:

  SELECT
    col1,
    col2,
    col3, -- grr, can't do this
  FROM tblExample

so my SQL diffs are the "removed this line and replaced it with
something almost identical except it now has a comma".  Harumph.

-tkc





More information about the Python-list mailing list