[Python-Dev] Add a "transformdict" to collections

Antoine Pitrou solipsis at pitrou.net
Wed Sep 11 13:07:15 CEST 2013


Le Wed, 11 Sep 2013 13:37:53 +0300,
Serhiy Storchaka <storchaka at gmail.com> a écrit :
> 
> Actually the defaultdict is just simple wrapper around existing 
> functionality of the __missing__ method. We can add the __transform__ 
> method directly in the dict class. I think it will significant (2-3x) 
> decrease a size of needed C code (no need in defining new type with 
> constructors/destructors/etc, only lookup_transform).

Right now I am not proposing any C implementation of TransformDict.
That could be added, but it's not what I'm pushing for here :-)

But I don't think the "type generator" API would be easier to implement
in C, anyway.

Regards

Antoine.




More information about the Python-Dev mailing list