That is exactly what I meant, in fact. These IO thing are expected to have side effects so they are not subtle. Generator on the other hand, is sort of "clever iteratables".
Now that I notice that, Of course I can be sure I would be careful. But what about the following situation : I import some function from some third party module which said, "oh, my function returns a iteratable". Then I can only list(o) if I want to pass it around or I consume it in only one and only one place. turning it into a list completely negate what generator is intended for(generate as much as you need) and using it in only one and only one place(like your fread example) would IMO means its usage is pretty limited. Beside, I can do a fseek to rewind a file handle but not a generator object. Fredrik Lundh wrote: > > > As when the program/system goes beyond a single module, this behaviour > > can cause subtle bugs ? > > sure, in the same way as > > >>> f = open(filename) > >>> f.read() > 'hello world\n' > >>> f.read() # oops! > '' > > causes subtle bugs (that is, almost never) > > </F> -- http://mail.python.org/mailman/listinfo/python-list