which one do you prefer? python with C# or java?

Paul Rubin no.email at nospam.invalid
Fri Jun 15 15:04:29 EDT 2012


Terry Reedy <tjreedy at udel.edu> writes:
> Python iterators can do lazy evaluation. All the builtin classes come
> with a corresponding iterator. ...

I wouldn't say iterators do lazy evaluation in the Scheme or Haskell
sense.  Lazy evaluation imho means evaluation is deferred until you
actually try to use the value, and when you use it, it is computed and
kept around for later re-use (until it becomes gc-able).  Python
iterators simply generate one value at a time and leave retention of old
values to be managed by the programmer.

> There is nothing simulated about yield. Python mostly does what you
> tell it to do. You just have to learn how to tell it to do what you
> want.

I'd be interested in seeing a clean implementation of that algorithm
using python iterators.



More information about the Python-list mailing list