Is except: ... pass bad style?

marduk marduk at python.net
Thu Sep 9 13:56:55 EDT 2004


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

Which is okay if you don't care about the return value of the 
method (in my examples I'm assuming .method() just does something
(and returns None).  But it's a lot uglier I think than the try/except
block.




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---



More information about the Python-list mailing list