Skip to content

Instantly share code, notes, and snippets.

@troter
Created October 15, 2011 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save troter/1289101 to your computer and use it in GitHub Desktop.
Save troter/1289101 to your computer and use it in GitHub Desktop.
finally timing
% python [31909]
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def g():
... try:
... yield 1
... finally:
... print "finished"
...
>>> g().next()
finished
1
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment