Lists And Extra Commas at end

Cameron Simpson cs at cskk.id.au
Tue Dec 24 21:40:14 EST 2019


On 25Dec2019 01:20, mail.python.org at marco.sulla.e4ward.com <mail.python.org at marco.sulla.e4ward.com> wrote:
>About the extra comma, it's da**ed useful:
[...]
>The real problem is this one:
>
>a = 1,
>
>Unreadable and prone to subtle errors, because maybe you added the
>comma by mistake. Caution: Debugging Nightmares.

Hoo, yes. Only the other week I spent _way_ too long debugging exactly 
that mistake because I'd cut/pasted a parameter into some inline code.  
Suddenly a int was a tuple.

With luck I'll recognise that mistake faster next time.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list