Message85958
| Author |
dschult |
| Recipients |
dschult, loewis, rhettinger |
| Date |
2009年04月14日.02:51:27 |
| SpamBayes Score |
9.0682484e-08 |
| Marked as misclassified |
No |
| Message-id |
<4F1C87A8-4E40-4991-8FC3-E2E1D0E6C3D6@colgate.edu> |
| In-reply-to |
<49E2F8E8.7050205@v.loewis.de> |
| Content |
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 |
|