Skip to content

Instantly share code, notes, and snippets.

from resources import MyResource
res = MyResource()
res.get_resource_uri()
# returns ''
res.get_resource_uri()
# returns '/api/v1/myresource/'
@evan2m
evan2m / benchmark.py
Last active July 17, 2019 19:28
Benchmark counters in python
import timeit
from shakespeare import LETTERS, WORDS
if __name__ == '__main__':
# defaultdict
t = timeit.Timer(stmt="""
counter = defaultdict(int)
for k in LETTERS: