Author Mike.Lissner
Recipients Mike.Lissner, brett.cannon, g.starck@gmail.com, loewis, mark.dickinson, rhettinger, zuo
Date 2016-03-29.18:48:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1459277307.08.0.164277187103.issue10682@psf.upfronthosting.co.za>
In-reply-to
Content
This is an old issue, but where I run into it frequently is when I use the format function and string interpolation. For example, this throws a SyntaxError:

"The name of the person is {name_first} {name_last}".format(
    **my_obj.__dict__,
)

Because strings tend to be fairly long, it's pretty common that the arguments to format end up on their own line. 

I was always taught to use trailing commas in Python, and I'm fanatical about ensuring they're there. It's a smart part of the language that saves you from many bugs and much typing when copy/pasting/tweaking. 

This is the first time I've ever run into an implementation bug in CPython, and at least from the post on StackOverflow, this looks like the parser isn't obeying the grammar: https://stackoverflow.com/questions/16950394/python-why-is-this-invalid-syntax
History
Date User Action Args
2016-03-29 18:48:27Mike.Lissnersetrecipients: + Mike.Lissner, loewis, brett.cannon, rhettinger, mark.dickinson, zuo, g.starck@gmail.com
2016-03-29 18:48:27Mike.Lissnersetmessageid: <1459277307.08.0.164277187103.issue10682@psf.upfronthosting.co.za>
2016-03-29 18:48:27Mike.Lissnerlinkissue10682 messages
2016-03-29 18:48:26Mike.Lissnercreate