On Wed, Jul 24, 2013 at 8:58 AM, Skip Montanaro <s...@pobox.com> wrote: >> What do you mean? Why would you want to create a temporary list just to >> iterate over it explicitly or implicitly (set, sorted, max,...)? > > Because while iterating over the keys, he might also want to add or > delete keys to/from the dict. You can't do that while iterating over > them in-place.
None of the (set, sorted, max, ...) cases will add or delete keys while iterating. For the occasional for loop where the programmer does want to do that, you can still explicitly create a temporary list with list(). -- http://mail.python.org/mailman/listinfo/python-list