This commit is contained in:
Dominik Moritz Roth 2022-11-18 15:57:34 +01:00
parent 753b09332b
commit 4c39250ee5
2 changed files with 61 additions and 0 deletions

View File

@ -1,6 +1,10 @@
Is it a list? Is it a generator? No its a
# LazyList
<p align='center'>
<img src='./lazylist.svg'>
</p>
Have you ever found yourself in a situation, where you used a generator, but then realized, that you sometimes need an element from further in the future? Or specific past element? This very specific problem is no more, thank to LazyList! (Wow!)
## What does it do?
@ -9,3 +13,11 @@ The LazyList is mutable and inserts, appends and extends are possible. The LazyL
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.
## Attribution
Icon is based on:
Lazy by Adrien Coquet from <a href="https://thenounproject.com/browse/icons/term/lazy/" target="_blank" title="Lazy Icons">Noun Project</a>
List by Kirby Wu from <a href="https://thenounproject.com/browse/icons/term/list/" target="_blank" title="List Icons">Noun Project</a>

49
lazylist.svg Normal file
View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="202.64076mm"
height="67.765144mm"
viewBox="0 0 202.64076 67.765144"
version="1.1"
id="svg5"
xml:space="preserve"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#999999"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false" /><defs
id="defs2" /><g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-4.7835542,-69.528006)"><g
id="g267"
transform="matrix(0.31351687,0,0,0.31351687,-40.947367,53.102985)"><path
d="m 767.56954,156.53004 h -62.719 c -13.441,0 -24.641,11.199 -24.641,24.641 v 25.758 l -4.4805,-2.8008 -28.559,-19.598 v 19.602 h -50.961 v -22.961 c 0,-13.441 -11.199,-24.641 -24.641,-24.641 h -62.719 c -13.441,0 -24.641,11.199 -24.641,24.641 v 25.199 l -3.3594,-2.2383 -28.562,-19.602 v 19.602 h -52.078 v -22.961 c 0,-13.441 -11.199,-24.641 -24.641,-24.641 h -62.719 c -4.47717,0 -24.641,11.0369 -24.641,15.2251 v 72.1349 c 0,13.441 11.199,24.641 24.641,24.641 h 62.719 c 13.441,0 24.641,-11.199 24.641,-24.641 v -22.961 h 52.078 v 19.602 l 28.559,-19.602 3.3594,-2.2383 v 25.199 c 0,13.441 11.199,24.641 24.641,24.641 h 62.719 c 13.441,0 24.641,-11.199 24.641,-24.641 v -22.961 h 50.961 l 0.004,19.602 28.559,-19.602 4.4805,-2.7969 v 25.762 c 0,13.441 11.199,24.641 24.641,24.641 h 62.719 c 13.441,0 24.641,-11.199 24.641,-24.641 v -62.723 c 0,-13.441 -11.199,-24.641 -24.641,-24.641 z m -384.16,87.359 c 0,4.4805 -3.3594,7.8398 -7.8398,7.8398 h -62.719 c -4.4805,0 -7.8398,-3.3594 -7.8398,-7.8398 v -62.719 c 0,-4.4805 3.3594,-7.8398 7.8398,-7.8398 h 62.719 c 4.4805,0 7.8398,3.3594 7.8398,7.8398 z m 196,0 c 0,4.4805 -3.3594,7.8398 -7.8398,7.8398 h -62.719 c -4.4805,0 -7.8398,-3.3594 -7.8398,-7.8398 v -62.719 c 0,-4.4805 3.3594,-7.8398 7.8398,-7.8398 h 62.719 c 4.4805,0 7.8398,3.3594 7.8398,7.8398 z m 196,0 c 0,4.4805 -3.3594,7.8398 -7.8398,7.8398 h -62.719 c -4.4805,0 -7.8398,-3.3594 -7.8398,-7.8398 v -62.719 c 0,-4.4805 3.3594,-7.8398 7.8398,-7.8398 h 62.719 c 4.4805,0 7.8398,3.3594 7.8398,7.8398 z"
id="path197"
sodipodi:nodetypes="csscccccsssscccccsssssssscccccsssscccccsssssccsssssssssssssssssssssssssss" /></g><path
d="M 70.868476,102.18491 H 54.507592 l -5.095992,2.42675 v 2.27977 c 0,0.3233 0.242616,0.56648 0.566481,0.56648 H 63.40538 l 5.764719,-0.002 h 1.779507 c 0.3233,0 0.56647,-0.24261 0.56647,-0.56648 l -5.9e-4,-4.14002 c -0.0807,-0.3233 -0.32329,-0.56592 -0.64716,-0.56592 z"
id="path416-8"
style="stroke-width:0.14444"
sodipodi:nodetypes="cccssccscccc" /><g
id="g506"
transform="matrix(0.29462651,0,0,0.29462651,-21.75318,-58.994947)"><path
d="m 200.35519,580.08133 h -13.72696 l -10.43297,4.94072 c -4.11731,1.64694 -8.23667,2.47041 -12.08022,2.47041 -5.21673,0 -13.17738,-3.29388 -18.12007,-9.33384 -4.39306,-5.21673 -7.13752,-12.35377 -8.51022,-16.19732 -3.84345,-10.70702 -9.33384,-28.8271 -13.17739,-42.00448 -0.82347,-2.74618 -1.64694,-5.4903 -2.19656,-7.6871 -3.84345,-0.54962 -7.68709,-1.64694 -11.8042,-3.02003 -0.27385,1.37309 -0.27385,2.74618 0.27385,4.1173 l 23.33681,76.04734 v 48.3184 c 0,4.39306 3.56959,8.23666 8.23666,8.23666 4.66692,0 8.23666,-3.84345 8.23666,-8.23666 v -41.18087 h 42.00449 v 41.73044 c 0,4.39306 3.5696,8.23666 8.23666,8.23666 4.66692,0 8.23667,-3.84345 8.23667,-8.23666 v -49.96612 c -0.27577,-4.39307 -4.11922,-8.23667 -8.51219,-8.23667 z"
id="path422"
style="stroke-width:0.490248" /><path
d="m 142.42743,560.31451 c 0.82347,2.19656 3.5696,9.60985 7.6871,14.55057 4.1173,4.94073 10.70703,7.41305 14.001,7.41305 3.02003,0 6.31391,-0.54962 9.88341,-2.19656 l 87.30344,-40.90682 c 5.76631,-2.74617 8.23667,-9.60985 5.4903,-15.3737 -2.74618,-5.7663 -9.60985,-8.23666 -15.3737,-5.49029 l -5.4903,2.47041 c -0.82347,-0.82347 -1.64694,-1.64694 -2.74617,-2.19656 -7.6871,-4.39307 -26.35674,-14.55057 -37.33732,-14.82413 -3.5696,-0.27385 -12.08021,0 -27.45391,23.06079 -2.47042,-7.96065 -5.21674,-15.10014 -6.58943,-19.49325 8.78623,-1.37309 20.31638,-4.94073 27.17986,-13.17739 4.39307,-5.49029 6.31391,-12.08021 4.94072,-19.21725 -2.74617,-14.82413 -18.12007,-20.31638 -29.10065,-22.23718 0.54961,2.19656 0.82347,4.39307 0.82347,6.58943 0,4.66692 -1.09733,9.05979 -3.29388,13.17739 6.03986,1.37309 11.53064,3.84345 12.08021,6.31391 0.27384,1.37309 0,2.19656 -0.54962,3.02003 -3.5696,4.1173 -14.82413,7.13752 -23.33681,7.13752 h -26.35673 c -8.51023,0 -20.04087,-2.74617 -23.33681,-7.13752 -0.54962,-0.82347 -1.09732,-1.37309 -0.82347,-3.02003 0.54962,-2.47041 5.7663,-4.94073 12.08021,-6.31391 -1.9227,-3.84345 -3.29388,-8.23667 -3.29388,-13.17739 0,-2.19656 0.27385,-4.39307 0.82347,-6.58943 -10.70702,1.92271 -26.356737,7.41305 -29.100657,22.23718 -1.373088,7.13753 0.273848,13.72696 4.940724,19.21725 7.687093,9.33384 21.414053,12.62978 30.200283,13.45291 3.57347,10.70702 11.81009,38.43449 16.75081,52.71151 z m 65.34032,-33.22022 c 3.02002,0.82347 7.68709,2.74618 13.17738,5.4903 l -25.80716,12.08021 c 4.66883,-7.96066 9.60985,-14.82413 12.62978,-17.57051 z"
id="path424"
style="stroke-width:0.490248" /><path
d="m 170.43042,459.28411 c 0,12.73666 -10.32414,23.06276 -23.06079,23.06276 -12.73666,0 -23.0608,-10.32561 -23.0608,-23.06276 0,-12.73518 10.32414,-23.06079 23.0608,-23.06079 12.73665,0 23.06079,10.32561 23.06079,23.06079"
id="path426"
style="stroke-width:0.490248" /></g></g></svg>

After

Width:  |  Height:  |  Size: 5.8 KiB