DEV Community

Discussion on: Best practice for Python returns

Collapse
 
rfletchr profile image
Rob Fletcher

this is preferable

try:
   data = get_one({"name":"joe"})

except ConnectionError:
   # handle a ConnectionError

else:
   # if no exceptions were raised then the data is presumed to be good
   do_something_with(data)