[Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

Chris Angelico rosuav at gmail.com
Wed Mar 12 21:44:45 CET 2014


On Thu, Mar 13, 2014 at 4:09 AM, Guido van Rossum <guido at python.org> wrote:
> But the thing I can't get behind are the motivation and rationale. I don't
> think that e.g. dict.get() would be unnecessary once we have except
> expressions, and I disagree with the position that EAFP is better than LBYL,
> or "generally recommended" by Python. (Where do you get that? From the same
> sources that are so obsessed with DRY they'd rather introduce a
> higher-order-function than repeat one line of code? :-)

Hmm. Not actually sure where I got it from, except [1] that I've heard
it periodically advocated as a way to eliminate race conditions in
multitasking situations and such (in the same way that
stat-followed-by-open is vulnerable, so instead use try-open-except).

> This is probably the most you can get out of me as far as a pronouncement.
> Given that the language summit is coming up I'd be happy to dive deeper in
> my reasons for rejecting it there (if there's demand).

Geography prevents me from being there, but if anyone else asks and
the answer can be written down, I'm probably not the only one who
would read it with interest.

> I do think that (apart from never explaining those dreadful acronyms :-)

Hmm, I thought for some reason they were axiomatic Python, like "BDFL"
and "IDLE". :)

> this was a well-written and well-researched PEP, and I think you've done a
> great job moderating the discussion, collecting objections, reviewing
> alternatives, and everything else that is required to turn a heated debate
> into a PEP. Well done Chris (and everyone who helped), and good luck with
> your next PEP!

Thanks! And yes, thank you to everyone who offered suggestions, kept
the intelligent discussion going (it strayed a bit but never turned
into a flame war), and especially to everyone who helped with wording
and such. I'm only one person, and what seems patently obvious to me
isn't always obvious to someone else.

I have to say this PEP has been highly successful even without being
accepted. The next time anyone asks, they can be pointed to the PEP,
with its list of flawed syntax options. (The most common response, by
far, was "Nice idea but I don't like the syntax" - for any syntax
proposed.) Plus, it taught me how to use the ast module in research. I
don't know when that'll come in handy, but Sherlock Holmes was right -
all knowledge comes useful!

But I'm not going to devote myself to another PEP *quite* yet. Decimal
literals is in need of a champion, but I need to do other things,
unless someone's going to employ me to champion PEPs full time :)
(Hmm. That would be an interesting job title on the resume.)

ChrisA

[1] Pun intended. Sorry!


More information about the Python-Dev mailing list