sorteddict PEP proposal [started off as orderedict]
James Stroud
jstroud at mbi.ucla.edu
Tue Sep 25 16:30:04 EDT 2007
Mark Summerfield wrote:
> Hmmm, managed to confuse myself with 'b' and 'd'!
>
> d = sorteddict({1:"one", 3:"three", 5:"five", 99:"ninetynine"})
>
> d.items()
>
> [(1, 'one'), (3, 'three'), (5, 'five'), (99, 'ninetynine')]
>
> d[3], d.value(3)
>
> ('three', 'ninetynine')
>
> So using [] returns the value for the given key and using value()
> returns the value for the given index position.
>
I didn't read enough messages. My last post is redundant.
More information about the Python-list
mailing list