[Python-3000] Iterators for dict keys, values, and items == annoying :)

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Mar 25 05:18:33 CET 2006


Aahz wrote:
> On Fri, Mar 24, 2006, Greg Ewing wrote:

>>   for x from iterator:

> How would you distinguish?  What about objects that are their own
> iterator (such as files)?

Files would really and truly be iterators (i.e.
they would have a next() method) and you would
need to use

   for line from a_file:
      ...

Greg


More information about the Python-3000 mailing list