Is except: ... pass bad style?

Alex Martelli aleaxit at
Thu Sep 9 22:27:03 CEST 2004

marduk <marduk at> wrote:

> Based on all the responses received thus far, I thought of a way of
> doing it without an exception:
> myobj.__dict__.get('method', lambda : None)()

Have you TRIED this?  most likely, myobj.method is NOT reaching into
myobj.__dict__, but rather into type(myobj).  getattr is WAY superior!


More information about the Python-list mailing list