Message 85958 - Python tracker (original) (raw)

Thank you... I stand corrected.... That's actually very helpful!

Of course using defdict makes the default assignment take two hashes,
two lookups, an attribute/function lookup (missing) and the extra
function call, plus doesn't allow arguments to the object factory...
but it means that there is a hook into the dict API that allows us to
create something when GetItem/subscript gives a KeyError... I
understand much more what I should be doing and where to look for it.

Thanks very much!

I still would prefer that the C-API allow PyDict_SetItem to be called
without a hash or lookup. Maybe a method called PyDict_SetEntry().
But I haven't really looked at it, don't have a patch and am not sure
if it is worth it. I am willing to spend time doing looking into
that kind of thing if you think that might be helpful. Otherwise I
will put it on my list of fun-projects-for-hazy-summer-weekends and
get to it when I get to it.

Dan