Skip to content

Instantly share code, notes, and snippets.

@earthling-shruti
Last active December 14, 2015 20:48
Show Gist options
  • Save earthling-shruti/5145952 to your computer and use it in GitHub Desktop.
Save earthling-shruti/5145952 to your computer and use it in GitHub Desktop.
#------------------------
#in else block
try:
obj = db.create_obj():
except DBExploded as e:
fail, return
else:
#obj is guarenteed to be valid object
obj.do_something()
obj.save()
#------------------------
#not in else block
try:
obj = db.create_obj():
except DBExploded as e:
fail, return
#obj is guarenteed to be valid object
obj.do_something()
obj.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment