[Edu-sig] Kirby Urner's Sieve of Eratosthenes
Mon, 5 Jun 2000 16:45:09 -0700 (PDT)
On Mon, 5 Jun 2000, Kirby Urner wrote:
> This I like quite a bit! Good job.
> Ka-Ping, if you have no objection, maybe I'll swap in the
> above on http://www.inetarena.com/~pdx4d/ocn/numeracy2.html ?
Sure, feel free to use whatever you like.
> Note: also change var name to final in the lamda, as
> sieve=sieve looks more cryptic IMO.
Perhaps it's just a matter of personal taste, but i actually
tend to prefer using the same variable name both inside and
outside a lambda in this situation. It's more consistent,
and the idiom "spam=spam" is a tip that you're passing local
variables to an inner scope.
This way, you can almost create the illusion that Python has
a form of lexical scoping that requires declaring what names
should be visible in the inner scope, and that the syntax for
such a declaration is ", spam=spam".
It's a lie, but a helpful lie. :)