Re: obtaining the reversal of a sequence?
Lou Kates (firstname.lastname@example.org)
Fri, 22 Oct 1993 05:12:14 -0400
>> It occurs to me that the compiler could probably generate optimized code
>> in the case where it sees the statement
>> for <ident> in range(<expression>):
>> The list result of range() never really needs to exist, in this case, no?
>Well the compiler isn't very good at recognizing calls to built-in
>functions ('range' could be a local identifier with a different
>meaning). But someone else proposed that range() return a new object
>type that behaves like a sequence but doesn't store all its elements,
>just returns the one you ask for.
Presumably this is not the only instance where lazy evaluation
could apply to Python.
Also, the Icon language is something to look at here since its
generation and lazy evaluation of infinite sequences is close to
what is being discussed here.
Lou Kates, email@example.com