Hi, I wonder what's the reason for iterating over a dict by keys:
>>> for x in {1:"a", 2:"b"}: ... print x ... 1 2 I find it much more intuitive for the values, "a" and "b", to be accessed. This is particularly confusing as iterating over tuples, lists and sets in the same way does access the values. (It feels like iterating over a list l actually iterates over the index values, range(len(l)).) In fact, iterating over any container should access the contained values. The reason I ask this on the python-3000 list is that I wonder whether the iterating behaviour of dicts might be changed in Python 3k, so that in the above code, foo() would be applied to the dict's values. -- Thomas _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com