is this data structure build-in or I'll have to write my own class?

Duncan Booth duncan.booth at invalid.invalid
Wed Feb 20 09:28:42 EST 2008


"Jorge Vargas" <jorge.vargas at gmail.com> wrote:

>  I was thinking having a base class like Bunch
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308 and on
> top of that keeping a list of the keys and pop/push to the list when
> adding/deleting items. I don't like this idea because I'll have to
> keep each key twice

You do realise I hope that just because the key appears in both a 
dictionary and a list doesn't mean you have two copies of the key? If the 
same object is used in a dictionary and a list then all you have is an 
extra reference to the same object.



More information about the Python-list mailing list