Creating a dict-like class that counts successful and failed key matches

python at bdurham.com python at bdurham.com
Mon Jun 30 12:47:14 EDT 2014


Ethan,

> Keep in mind that dict /will not/ call your overridden methods, so if, for example, you provide your own __getitem__ you 
will also need to provide your own copies of any dict method that calls
__getitem__.

I'm not sure I understand. Are you saying that Chris's __getitem__ will
not be called by other dict methods that would normally call this magic
method and instead call the parent's __getitem__ directly (via super()
or something similar?)?

Is this specific to the native Dict class (because its implemented in C
vs. Python?) or is this behavior more general.

Malcolm



More information about the Python-list mailing list