消息 [85958]
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 |
|
| 日期 |
用户 |
动作 |
参数 |
| 2009-04-14 02:51:30 | dschult | 修改 | recipients:
+ dschult, loewis, rhettinger |
| 2009-04-14 02:51:29 | dschult | 链接 | issue5730 messages |
| 2009-04-14 02:51:27 | dschult | 创建 | |
|