On Sat, Jan 4, 2014 at 2:32 PM, Dan Stromberg <drsali...@gmail.com> wrote: > That is fine, sorting once at then end of a script is a good use of > sorted(some_dict.keys()). However, it probably should be pointed out > that this, while similar, is not so good: > > for thing in range(n): > for key in sorted(some_dict.keys()): > do_something(thing, key) > > ...because it's sorting n times.
Oh! Yeah. Yeah, that would be inefficient. ChrisA -- https://mail.python.org/mailman/listinfo/python-list