Created
September 19, 2013 18:37
-
-
Save bulv1ne/6627905 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timeit.timeit('x()', setup=''' | |
def create_constant(value): | |
return itertools.repeat(value).next | |
x=create_constant("") | |
''') | |
#0.13626525126508682 | |
timeit.timeit('x()', setup='def x(): ""') | |
#0.17869136946876552 | |
timeit.timeit('x()', setup='x = lambda: ""') | |
#0.18088355837787162 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment