[Edu-sig] digits of pi
kirby urner
kirby.urner at gmail.com
Sat Jul 29 18:14:23 CEST 2006
> Are both things: Python generators and lazy evaluation, two
> different tools that solve the same domain of problems?
>
> Daniel
>
They're definitely in the same domain, and a generator may be viewed
as a lazy evaluator.
The business term for these things is JIT (just in time), a principle
used in source code evaluation as well.
It's *not* always an advantage for some busy bee resource hog to run
out ahead and evaluate the next 20 million prime numbers, if you're
really only needing another five or ten of them.
A lazy evaluator compresses enough knowledge (we hope) to spit back a
*next* in sequence, without overloading the processor with a bunch of
extraneous results.
What I see as a pitfall of lazy evaluation is identified by
Wittgenstein as well: this tendency to see a machine for generating
the next in sequence, and taking that as some mystical validation for
infinity, as in "the terms are already all there, in the machinery."
These mystics waste clock cycles boasting about how *their* language
already has all the natural numbers built in, etc. etc. At least in
Python the syntax reminds us we've been handed a state machine, not a
finished sequence.
My advice: ignore these mystics, at least when they've had too much to drink.
Kirby
More information about the Edu-sig
mailing list