> There seem to be two different ways to get/set/del from a dictionary. > > The first is using PyDict_[Get|Set|Del]Item() This is the API that all C code uses (except code that doesn't know whether it's dealing with dicts or some other mapping, which has to use PyObject_GetItem() etc, which is even slower). > The second is using the embarssingly named dict_ass_sub() and its > partner dict_subscript(). This is what PyObject_GetItem() calls. > Which of these two access methods is most likely to be used? That's a hard question. Maybe a profiler can answer. The thing is, there's a lot of C code that calls PyDict_GetItem() directly, e.g. the attribute lookup code. Bot of course there's also a lot of Python code using dicts. Yet, I'd bet on PyDict_*(). --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4