minor change
This commit is contained in:
parent
a13757f87c
commit
6f7d8a055d
@ -49,8 +49,7 @@ class LazyList(object):
|
||||
|
||||
def LazyListIterator():
|
||||
count = start
|
||||
predicate = ((lambda: True) if stop is None
|
||||
else (lambda: count < stop))
|
||||
predicate = (stop is None) and (lambda: True) or (lambda: count < stop)
|
||||
while predicate():
|
||||
try:
|
||||
yield self[count]
|
||||
@ -139,4 +138,4 @@ if __name__ == '__main__':
|
||||
primes = primegen() #same for primes- treat it like an infinitely long list
|
||||
#containing all prime numbers.
|
||||
print fibs[0], fibs[1], fibs[2], primes[0], primes[1], primes[2]
|
||||
print list(fibs[:10]), list(primes[:10])
|
||||
print list(fibs[:10]), list(primes[:10])
|
||||
|
Loading…
Reference in New Issue
Block a user