STINNER Victor <vstin...@python.org> added the comment:

>python -m timeit -s "import collections; d=collections.defaultdict(lambda: 
>None); d['abc']=123; " "x=d['XXX']"
5000000 loops, best of 5: 34.3 nsec per loop

This benchmark is not a fair comparison: the 'XXX' key is created at the first 
access. In short, this benchmark measure the performance of a dict lookup:

>python -m timeit -s "d={'abc':123}" "x=d['abc']"
5000000 loops, best of 5: 33 nsec per loop

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38278>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to