[Python-Dev] Py3k: Except clause syntax (original) (raw)
Michael Hudson mwh at python.net
Fri Mar 17 10:06:13 CET 2006
- Previous message: [Python-Dev] Py3k: Except clause syntax
- Next message: [Python-Dev] Py3k: Except clause syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
skip at pobox.com writes:
Greg> except as :
Baptiste> except with : Can I catch multiple exceptions with a single value in this case? Today, I write: try: foo() except (TypeError, KeyError), msg: print msg Either of the above seem like they'd require me to repeat the value, e.g: try: foo() except TypeError with msg, KeyError with msg: print msg Not very Pythonic methinks.
except TypeError or KeyError as msg: !
not-serious-ly y'rs, mwh
-- That's why the smartest companies use Common Lisp, but lie about it so all their competitors think Lisp is slow and C++ is fast. (This rumor has, however, gotten a little out of hand. :) -- Erik Naggum, comp.lang.lisp
- Previous message: [Python-Dev] Py3k: Except clause syntax
- Next message: [Python-Dev] Py3k: Except clause syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]