Do something after return
There is a trick in #Python which allows you to do something after return. This is dirty and should be used only to debug something! We just use try/finally with return statement.
def somefun():
data = {}
try:
return data
finally:
print data
Written by Dominik "Socek" Długajczyk
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#