assigning a custom mapping type to __dict__
Nick Coghlan
ncoghlan at iinet.net.au
Tue Mar 1 05:56:38 EST 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 :)
Cheers,
Nick.
[1] http://www.python.org/dev/doc/devel/api/dictObjects.html
[2] http://www.python.org/dev/doc/devel/api/mapping.html
--
Nick Coghlan | ncoghlan at email.com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
More information about the Python-list
mailing list