[Python-Dev] PEP 409 and the stdlib (original) (raw)
Hrvoje Niksic hrvoje.niksic at avl.com
Tue May 21 12:05:37 CEST 2013
- Previous message: [Python-Dev] PEP 409 and the stdlib
- Next message: [Python-Dev] PEP 409 and the stdlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 05/21/2013 11:56 AM, Serhiy Storchaka wrote:
try: x = d['key'] except KeyError: x = fallback('key')
def fallback(key): if key not in a: raise BusinessError(...) return 1 / a[key] # possible TypeError, ZeroDivisionError, etc
Yes, in that case the exception will appear unintentional and you get the old message — it's on a best-effort basis.
Hrvoje
- Previous message: [Python-Dev] PEP 409 and the stdlib
- Next message: [Python-Dev] PEP 409 and the stdlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]