From 753b09332b226d5e5e567d694aeb48ee6b640632 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Fri, 18 Nov 2022 15:42:02 +0100 Subject: [PATCH] Text --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 601fae0..7fbbd7a 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,7 @@ Have you ever found yourself in a situation, where you used a generator, but the ## What does it do? It's a list, that gets initialied using an iterable. The list uses the iterable to generate when new elements are accessed. -The LazyList is mutable and inserts, appends and extends are possible. The LazyList never contains holes, if you access at an index, all previous indexes that have not been generated will also be generated. You can use peak(1) to access the next element without incrementing the exposed iterable, peak(-3) looks 3 iterations into the past, peak(0) gives the current value... +The LazyList is mutable and inserts, appends and extends are possible. The LazyList never contains holes, if you access at an index, all previous indexes that have not been generated will also be generated (append and extend will therefore let the generator run until it is empty). You can use peak(1) to access the next element without incrementing the exposed iterable, peak(-3) looks 3 iterations into the past, peak(0) gives the current value. lazyList[n] gives element at index/iteration n; lazyList[-1] return the last element (will run the generator until termination) + +When you try to access at an index, that the generator never generates, you get a StopIteration-Exception. +len(lazyList) will return inf, while the generator end has not been reached.