Skip to content

Instantly share code, notes, and snippets.

@andreagrioni
Last active June 21, 2021 22:51
Show Gist options
  • Save andreagrioni/a441959aa6700ae662eaac13251f0d39 to your computer and use it in GitHub Desktop.
Save andreagrioni/a441959aa6700ae662eaac13251f0d39 to your computer and use it in GitHub Desktop.
# Comprehension
actions = [1,2,3]
accepted = [1,2]
eval_args = { (action) : (True if action in accepted else False) for action in actions }
# time I
import timeit
def ciao():
a = sum([ i for i in range(0,1000)] )
return(a)
timeit.timeit("ciao()", number=1000, setup="from __main__ import ciao")
# time II
import time
start_time = time.time()
end = time.time() - start_time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment