[EMAIL PROTECTED] wrote: > I initially thought that generator/generator expression is cool (sort of > like the lazy evaluation in Haskell) until I notice this side effect. > > >>>a=(x for x in range(2)) > >>>list(a) > [1,2] > >>>list(a) > [] > > Would this make generator/generator expression's usage pretty limited ?
nope. > 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