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

Nick Coghlan ncoghlan at gmail.com
Thu Mar 13 07:23:15 CET 2014


On 13 March 2014 07:49, Chris Angelico <rosuav at gmail.com> wrote:
>
> Umm, yeah, that one. Why did I think hasattr was the only way around
> that? Anyway, that just means I picked a bad example. There are others
> where you have to go for the full try/except.

You may have been thinking of item lookup on sequences. Attribute
lookup can switch to getattr (at the cost of becoming more opaque to
the compiler and static analysers), and mappings can fall back to
get(), but there's no such alternative for sequences.

Anyway - exemplary work on the PEP, even though Guido remained
unconvinced. Not only does it become a useful resource if anyone else
comes forward with a similar proposal, it becomes something we can
point to and perhaps revisit next time someone asks for implicit
exception handling to be added to yet another API :)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list