On 2025-12-29 12:11:04 +0200, Schimon Jehudah via Python-list wrote: > Would not it be appropriate by argparse to deny (i.e. raise an error) > attempts to allocate a reserved keyword as destnation (i.e. "dest")?
I'm not convinced. It wouldn't actually help you except by possibly
making the error message easier to understand, but it would remove some
functionality (as we've pointed out, you can access the argument, it's
just a bit less convenient - for some applications that may not matter).
As for the error message, I agree that "SyntaxError: invalid syntax" is
a pretty uninformative message. Python error messages in general have
become very good over the last few years, so that feels like a bit of a
throwback. I think it would be generally useful to improve that message
(maybe something like "expected identfier, got reserved word 'class'").
hjp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | [email protected] | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman3//lists/python-list.python.org
