On Sat, Jan 4, 2014 at 1:58 PM, Dan Stromberg <drsali...@gmail.com> wrote: > On Fri, Jan 3, 2014 at 7:37 AM, Chris Angelico <ros...@gmail.com> wrote: >> Depending on what exactly you need, it's probably worth just using a >> dict. In what ways do you need it to function as a list? You can >> always iterate over sorted(some_dict.keys()) if you need to run >> through them in order. > > FWIW, sorting inside a loop is rarely a good idea, unless your lists > are pretty small.
What do you mean by "sorting inside a loop"? I was thinking of this: for key in sorted(some_dict.keys()): # blah blah which will sort once and then iterate over it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list