[Python-Dev] Add more SyntaxWarnings?

Stephen J. Turnbull turnbull.stephen.fw at u.tsukuba.ac.jp
Mon Jan 28 23:44:17 EST 2019


Chris Barker - NOAA Federal writes:
 > > > But as a rule,
 > > > there are a LOT of errors that can be pretty mysterious to newbies.
 > >
 > > Isn't that the very definition of "newbie"?  That's half a joke, but I
 > > really don't think that programmers new to Python should be the
 > > standard.
 > 
 > Python is broadly advocated (and used) as a first language to learn.
 > Because it is.
 > 
 > So I think anything we can do to help newbies, *that doesn’t make the
 > language less powerful, or even more annoying for experienced
 > developers* is a good thing.
 > 
 > That is: prioritizing newbie-friendliness is good. Prioritizing it
 > over other important things is not.

I don't disagree.  I disagree with the conclusion that it's worth the
effort to try to improve all error messages that confuse new users,
because new users (by definition) don't know enough to respond
usefully in many cases.  In those cases, they need to be told what's
going on and why, where more experienced users can figure it out from
their background knowledge of Python semantics.  Embedding a "theory
of operations" note in every error message would be possible, but I
don't think it's a good idea -- it would certainly make the language
more annoying for experienced developers.

That's why I proposed the criterion

 > > The problematic cases are those where even a relatively
 > > experienced Python programmer needs to be told why an error is
 > > raised, because it's too hard to figure out from background
 > > knowledge of the language, you need to know about implementation
 > > internals.

Maybe that's too strict.  The pleasant hacks of giving ``quit`` and
``help`` "values" as variables are certainly useful.  On the contrary,
getting rid of the print statement was perhaps a better idea. :-)

Steve


More information about the Python-Dev mailing list