Is except: ... pass bad style?

Michael Hudson mwh at python.net
Thu Sep 9 20:17:59 CEST 2004


marduk <marduk at python.net> writes:

> 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)()

Uh, I'd say that's pretty unlikely to work.  What's wrong with
getattr()?

Cheers,
mwh

-- 
  <dash> wow. this code does something highly entertaining, but
         nowhere near correct                   -- from Twisted.Quotes



More information about the Python-list mailing list