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

Chris Angelico rosuav at gmail.com
Wed Mar 12 22:49:07 CET 2014


On Thu, Mar 13, 2014 at 8:37 AM, Tres Seaver <tseaver at palladion.com> wrote:
> On 03/12/2014 04:49 PM, Chris Angelico wrote:
>> You can use hasattr() in place of AttributeError
>
> I use:
>
>  getattr(subject, attrname, default)?
>
> *all the time*.

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.

ChrisA


More information about the Python-Dev mailing list