[Python-Dev] PEP 463: Exception-catching expressions

Stephen J. Turnbull stephen at xemacs.org
Sat Feb 22 13:14:05 CET 2014


Antoine Pitrou writes:
 > On Sat, 22 Feb 2014 22:13:58 +1100
 > Chris Angelico <rosuav at gmail.com> wrote:

 > > hasattr(x,"y") <-> (x.y or True except AttributeError: False)

 > But it's not the same. hasattr() returns a boolean, not an arbitrary
 > value.

I think he meant 

    hasattr(x,"y") <-> (x.y and True except AttributeError: False)



More information about the Python-Dev mailing list