[Python-Dev] PEP needed for http://bugs.python.org/issue9232 ?

R. David Murray rdmurray at bitdance.com
Tue Aug 11 16:46:59 CEST 2015


On Tue, 11 Aug 2015 18:09:34 +1200, Robert Collins <robertc at robertcollins.net> wrote:
> So, there's  a patch on issue 9232 - allow trailing commas in function
> definitions - but there's been enough debate that I suspect we need a
> PEP.
> 
> Would love it if someone could correct me, but I'd like to be able to
> either categorically say 'no' and close the ticket, or 'yes and this
> is what needs to happen next'.

I think we might just need another round of discussion here.

I'm +1 myself.  Granted there haven't been many times I've wanted it
(functions with enough arguments to want to make it easy to add and
remove elements are a bit of a code smell), but I have wanted it (and
even used the form that is accepted) several times.  On the other hand,
the number of times when the detection of a trailing comma has revealed
a missing argument to me (Raymond's objection) has been...well, I'm
pretty sure it is zero.  Especially since it only happens *sometimes*.
Since backward compatibility says we shouldn't disallow it where it is
currently allowed, the only logical thing to do, IMO, is consistently
allow it.

(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!)

--David


More information about the Python-Dev mailing list