[Python-ideas] Potential PEP: with/except

Steven D'Aprano steve at pearwood.info
Tue Jan 22 20:05:17 EST 2019


On Tue, Jan 22, 2019 at 03:22:27PM -0700, Paul Ferrell wrote:

> Anecdotally, I showed the with/except example to my student (who's
> relatively new to python), to see how he interpreted it. He (correctly?)
> assumed the CM operations were within the 'try', and was pretty surprised
> when I told him that the except part of the with wasn't actually valid
> Python.

One of the more pernicious myths about language design is that if 
something surprises a beginner, it must be a bad idea. The reality is 
that beginners are the worst people to judge what is good or bad or 
consistent, because they don't have the knowledge or experience to 
recognise deep consistency or flaws in an feature.

I'm just making a general observation here, not making a specific claim 
that this specific proposal is flawed (beyond the point I made earlier 
that it may be unnecessary and redundant). But anecdotes about 
"beginners were surprised by..." don't carry much weight with me.

(Not "zero weight", it isn't as if I *want* to surprise beginners, and 
sometimes newcomers to a language can spot things which experts are so 
used to they don't notice any longer.)

-- 
Steve


More information about the Python-ideas mailing list