assigning a custom mapping type to __dict__

Nick Coghlan ncoghlan at
Tue Mar 1 11:56:38 CET 2005

Daniel Cer wrote:
> Why not just inherit from dict? That seems to work.

Because that isn't the question - Steven knows how to make it work, what he's 
curious about is why things are the way they are :)

Anyway, a quick look suggests that it is due to typeobject.c using the concrete 
PyDict_* API calls [1] to manipulate tp_dict, rather than the abstract 
PyMapping_* calls [2]. The reason behind using the concrete API is, presumably, 
a question of speed :)


Nick Coghlan   |   ncoghlan at   |   Brisbane, Australia

More information about the Python-list mailing list