<div dir="ltr">On Fri, May 10, 2013 at 4:40 PM, Ezio Melotti <span dir="ltr"><<a href="mailto:ezio.melotti@gmail.com" target="_blank">ezio.melotti@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Fri, May 10, 2013 at 10:54 PM, MRAB <<a href="mailto:python@mrabarnett.plus.com">python@mrabarnett.plus.com</a>> wrote:<span style="color:rgb(34,34,34)">I also think that forgetting a comma in a list of function args</span><br>
</div>
between two string literal args is quite uncommon, whereas forgetting<br>
it in a sequence of strings (list, set, dict, tuple) is much more<br>
common, so this approach should cover most of the cases.<br></blockquote><div><br></div><div style>This is my experience as well. When I've run into problems by forgetting a comma it's nearly always been in a list, not in function arguments. (and it's never been between two items on the same line, so the proposal in one of the subthreads here to disallow implicit concatenation only between two strings on the same line wouldn't help much).</div>
<div style><br></div><div style>The problem is that in other languages, a trailing comma is forbidden, while in python it is optional. This means that lists like</div><div style> [</div><div style> 1,</div><div style>
2,</div><div style> 3,</div><div style> ]</div><div style><br></div><div style>may or may not have a comma after the third element. The comma is there often enough that you can fall out of the habit of checking for it when you extend the list. The most pythonic solution is therefore to follow the example of the single-element tuple and make the trailing comma mandatory ;)</div>
<div style><br></div><div style>-Ben</div></div></div></div>