[Tutor] single key ordered sequence

Senthil Kumaran orsenthil at gmail.com
Thu Jan 15 18:56:39 CET 2009

> Also, how to practically walk in reverse order in a list without
> copying it (e.g. items[::-1]),
> especially if i need both indexes and items (couldn't find with
> enumerate()).
Are you looking for reversed()?
The way you are doing it is probably OK. 
But it can be simplified thus:

keys = []
target = []

for item in reversed(items):
        if not item[0] in keys:

print target

If this is not what you wanted,then I have misunderstood your
requirement and just based it on your code.


More information about the Tutor mailing list