[issue34396] Certain methods that heap allocated subtypes inherit suffer a 50-80% performance penalty

Serhiy Storchaka report at bugs.python.org
Thu Apr 4 12:13:40 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

> But what's the use case of making somedict.__getitem__(x) fast? One should just write somedict[x] instead.

Using them in itertools functions. somedict.__getitem__ is faster that lambda: somedict[x].

As for map() and filter(), comprehensions are almost as fast as map() and filter() with somedict.__getitem__ and are more readable.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34396>
_______________________________________


More information about the Python-bugs-list mailing list