cpython: when PyDict_GetItem is called and when dict_subscript?
Posted
by gruszczy
on Stack Overflow
See other posts from Stack Overflow
or by gruszczy
Published on 2010-03-18T15:17:03Z
Indexed on
2010/03/18
15:21 UTC
Read the original article
Hit count: 577
I am reading cpython code for python 3k and I have noticed, that __missing__
is called only when dict_subscript
is called, but not when PyDict_GetItem
is used. What is the difference between those two methods and when each is called? If I pass an PyObject that is a subclass of dict and has __missing__
method, how can I force using it, since PyDict_GetItem
doesn't do that.
© Stack Overflow or respective owner