?Combination of a Dictionary and a List?

David Goodger dgoodger at bigfoot.com
Fri Jun 30 22:38:51 EDT 2000


on 2000-06-30 19:57, Norman Shelley
(Norman_Shelley-RRDN60 at email.sps.mot.com) wrote:

> Sometime  in the past I wrote a simple combination of a dictionary and a
> list, where __getitem__() would first look in a hidden dictionary and
> then if not found it would try looking in a hidden list.  I've seen this
> type of code out there somewhere also but I can not find my code or
> anyone elses. I guess I haven't figure our the "right" search criteria
> on www.python.org.  Any pointers?
> 

Many people have had such a need at some point (myself included; see my
signature below), but each with slightly different requirements. Do you want
a list that acts like a dictionary, or a dictionary that acts like a list,
and in what way?

Look for the c.l.p thread "indexed dictionaries?" of 2000-04-09, see
"seqdict" on Parnassus, and examine the "UserDict" and "UserList" modules in
the standard Python library.

-- 
David Goodger    dgoodger at bigfoot.com    Open-source projects:
 - The Go Tools Project: http://gotools.sourceforge.net
 (more to come!)




More information about the Python-list mailing list