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

dict.get() is a method call wheras "key in dict" and "dict[key]" are operators. 
Method calls are still slower than operators, even after past optimizations. 
For example, when dict.get was converted to METH_FASTCALL, it was around 20 ns 
faster:
https://vstinner.github.io/fastcall-microbenchmarks.html

See also closed bpo-17170 "string method lookup is too slow".

----------
nosy: +serhiy.storchaka, vstinner

_______________________________________
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