Quantcast
Channel: Catching exceptions in else - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Catching exceptions in else

$
0
0

Is this a good pythonic way to test something for equality, and catch exceptions in else?

try:    # Check for equality    debug.assert_eq(data, None)    debug.assert_eq(id, None)    debug.assert_eq(time, None)    debug.assert_eq(group, None)except Exception:    print("OK")else:    raise Exception('None found')

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>