Re: Challenging argparse with keyword dest="class"

"Peter J. Holzer" <[email protected]> Mon, 29 Dec 2025 15:53:54 +0100
Newsgroups gmane.comp.python.general
Message-ID <fen3424taiwpu7ao4os2f4plarr44tzhefevj3uikarzh6i3ph@lyz7woblzonx>
On 2025-12-29 22:50:41 +1100, Chris Angelico via Python-list wrote:
> On Mon, 29 Dec 2025 at 22:47, Peter J. Holzer <[email protected]> wrote:
> > 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'").
> 
> I wouldn't call it a throwback.

Yes, that was perhaps too strong a word. Anachronism? No, that's the
wrong direction.

Point is that we've been spoiled with high quality error messages in the
last few years, so now it's jarring to read a message which would have
been perfectly normal less than 10 years ago.

> Every improvement to the error messages happened because someone wrote
> code to detect a specific category of error and give a more helpful
> message.

Of course. Python doesn't improve itself. There are always people doing
the work. And useful error messages are particularly tricky.

        hjp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | [email protected]         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmlSlgIACgkQ8g5IURL+
KF09ow/+PWyVowy8I3RGXOi5eIXuZRvWVVQRqfxkKEddw77Kh1cg6eAVxXsNBJf+
jMGlHAVQhihu1APsd9RZaXnX3boC+G1+UmINnTbzr/NgfUznjHXljXaKHB0C7buA
ioDpj5r7ieSafX8zWjdJ2NOcWtebvWEISopIuqHqnzJyIgHMXMn3BK789zJbSCUD
UVC3XJRUFixymByUnzcxUwKt7o24+tuDHuzhsUFweWs8egyPreny2VJsRDyeyhcK
FYuFJFYFtRp7aMeUHXSCj1LMoYInCgyBA6lSGpdeNHE+Lfy7nQ6zF1hKPYUzS4Nr
QMdcnKtFJFfVTjJvf7N50fMg/CJv9YJE00Qku1fx3YdIPtxCGdxkl454+eXiyA2O
cabZaLQWgHzit2d35RjN2iuFSitEir9WVXzRP1bqZdanwgyRUH4HrdJrIov2PW9f
TEX1wZPpNbuYpyHcnoBlM/pq9aZ1SsMhYBcoWiAvPv1iXlrgTeCsRuhuk1Aq2oQC
05p7MA6Ix4NGAzISGNyZPaRjBrJ3jqpJJ1xeFtEzV4O8MlyUeM2ZWvxxUU0/mil5
W+/FvzZTDnT1LzOJKZuzxGhPQpqOLQp0DIsvs9vCd9lwgtl0Mj+P8IKsKwOOr4DE
8/C/b+x4U/MqPTqls0ydphvASUjkyCKHrPxYwtsdbhF9wMF8Gqs=
=Yd2U
-----END PGP SIGNATURE-----