Re: How to create an array which can be used also as a dictionary

2009-09-10 Thread Terry Reedy
Hans Müller wrote: Hello, I have a lot of items having a name and a given sequence. To access these items fast in a sequence order they should be used as a list, but to be fetched fast by name they also should be in a dictionary. Have you looked at namedtuple or OrderedDict in collections mo

Re: How to create an array which can be used also as a dictionary

2009-09-10 Thread Chris Rebert
On Thu, Sep 10, 2009 at 12:51 PM, Hans Müller wrote: > Diez B. Roggisch wrote: >> Hans Müller wrote: >>> But what happens if i modify >>> a[1].value1 = 1000 >>> is >>> d["aax"].value1 now 1000 or still "hello" as in this example ? >> >> It's changed. Didn't you try that? >> > to be true, no - not

Re: How to create an array which can be used also as a dictionary

2009-09-10 Thread Hans Müller
Diez B. Roggisch wrote: > Hans Müller wrote: > >> Hello, >> >> I have a lot of items having a name and a given sequence. >> >> To access these items fast in a sequence order they should be used as >> a list, but to be fetched fast by name they also should be in a >> dictionary. >> >> Code could be

Re: How to create an array which can be used also as a dictionary

2009-09-10 Thread Diez B. Roggisch
Hans Müller wrote: > Hello, > > I have a lot of items having a name and a given sequence. > > To access these items fast in a sequence order they should be used as > a list, but to be fetched fast by name they also should be in a > dictionary. > > Code could be something like this. > > class i