Mike Lissner added the comment:
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
----------
nosy: +Mike.Lissner
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue10682>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com