[2.5.1.1/dictionary] Change sorting order?

Neil Cerutti neilc at norwich.edu
Fri Jan 22 08:35:26 EST 2010


On 2010-01-22, Gilles Ganault <nospam at nospam.com> wrote:
> Hello
>
> I use a dictionary to keep a list of users connected to a web
> site.
>
> To avoid users from creating login names that start with digits
> in order to be listed at the top, I'd like to sort the list
> differently every minute so that it'll start with the next
> letter, eg. display the list from A...Zdigits the first time,
> then B...ZAdigits, etc.

Resorting is more work than is needed. Just choose a different
starting index each time you display the names, and set up your
lister to wrap-around to your arbitrary starting index.

-- 
Neil Cerutti



More information about the Python-list mailing list