Overriding dict constructor
steve at REMOVE-THIS-cybersource.com.au
Mon Sep 20 14:15:02 CEST 2010
On Mon, 20 Sep 2010 11:53:48 +0000, Duncan Booth wrote:
> I was going to suggest overriding items() (or iteritems() for Python
> 2.x), but while that is another hole that your values leak out it isn't
> the hole used by the dict constructor.
Yes, I already override items(), keys(), values(), their iter...
versions, and just about every damn method that dicts have :/
I suspect that the dict() constructor is just grabbing the key/value
pairs directly from the underlying hash table. If that's the case, my
choices are to not inherit from dict at all, or take your suggestion and
keep an auxiliary dict alongside the main one.
More information about the Python-list