On Wed, 12 Aug 2015 01:03:38 +1000, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Aug 12, 2015 at 12:46 AM, R. David Murray <rdmur...@bitdance.com> > wrote: > > (If you wanted to fix an 'oops' trailing comma syntax issue, I'd vote for > > disallowing trailing commas outside of (). The number of times I've > > ended up with an unintentional tuple after converting a dictionary to a > > series of assignments outnumbers both of the above :) Note, I am *not* > > suggesting doing this!) > > Outside of any form of bracket, I hope you mean. The ability to leave > a trailing comma on a list or dict is well worth keeping: > > func = { > "+": operator.add, > "-": operator.sub, > "*": operator.mul, > "/": operator.truediv, > }
Sorry, "trailing comma outside ()" was a shorthand for 'trailing comma on a complete statement'. That is, what trips me up is going from something like: dict(abc=1, foo=2, bar=3, ) to: abc = 1, foo = 2, bar = 3, That is, I got rid of the dict(), but forgot to delete the commas. (Real world examples are more complex and it is often that the transformation gets done piecemeal and/or via cut and paste and I only miss one or two of the commas... But, for backward compatibility reasons, we wouldn't change it even if everyone thought it was a good idea for some reason :) --David _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com