[Edu-sig] Reversing dictionaries, closures, permutations etc.

Kirby Urner urnerk at qwest.net
Fri Jan 23 19:21:26 EST 2004


> I believe this is usually called "inverse".  In Python, "reverse"
> means reversing the order of the elements of a list,
> e.g. lst.reverse() and in 2.4 the reversed() built-in.
> 
> --Guido van Rossum (home page: http://www.python.org/~guido/)

OK.  

It's a bit of a namespace collision actually (between Python usage and the
wider world), as there's a popular notion of a "reverse phone directory"
wherein you lookup names by phone number instead of phone number by name
e.g. http://www.reversephonedirectory.com/ (just found myself by number).

So is 2.4 mylist.reversed() something that returns a list, vs. reverses it
in place?  Is there a parallel mylist.sorted()?

Kirby





More information about the Edu-sig mailing list