[docs] unnecessary coma in code-example

Georg Brandl georg at python.org
Sun Aug 12 11:31:50 CEST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/12/2012 10:00 AM, Sandro Tosi wrote:
> Hello Martin,
> 
> On Thu, Aug 2, 2012 at 7:03 AM, Martin <mpc4 at gmx.com> wrote:
>> Hi, sorry to bother, i think i found an unecessary comma at:
>> 
>> http://docs.python.org/py3k/tutorial/datastructures.html#nested-list-comprehensions
>
>> 
> I think it's just an cosmetic "problem" and probably the extra comma is
> there for uniformity with the 2 lines above it - given it's a no-op in this
> case (it generates no error after all) I'm inclined not to change it. Also
> it might also be a standard for the person that wrote the example to add an
> extra comma at the end of lists or tuples, because sometimes it might be
> relevand (f.e. ('A',) is a tuple, and the extra comma is needed there).

Another good reason to keep the trailing commata in enumerations is that
if you add another item, only one line of code will change.  Having to
add a comma in the previous line will generate a spuriously changed line
in the diff that makes it harder to review.

cheers,
Georg

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iEYEARECAAYFAlAneAUACgkQN9GcIYhpnLB8igCeO9YnnZTCm2Bw/aFR2FRUBtJ2
3d0AoKsc8ruZjRwOUKWE869z1Zp0+9Nt
=tTQt
-----END PGP SIGNATURE-----


More information about the docs mailing list