[code-quality] could itertools.cycle not make a copy of the iterable ?

2022-01-19 Thread jerome via code-quality
Hi everyone, first I'm not quite sure if this is the right place to make this kind of suggestion/ask question but, `itertools.cycle` makes a copy of the iterable its given and as the note says: this may require significant auxiliary storage. Maybe I don't see the reason why this is nescessary bu

[code-quality] Re: could itertools.cycle not make a copy of the iterable ?

2022-01-19 Thread Ian Stapleton Cordasco
On Wed, Jan 19, 2022 at 10:49 AM jerome via code-quality < [email protected]> wrote: > Hi everyone, first I'm not quite sure if this is the right place to make > this kind of suggestion/ask question but, `itertools.cycle` makes a copy of > the iterable its given and as the note says: this ma

[code-quality] Re: could itertools.cycle not make a copy of the iterable ?

2022-01-19 Thread David Stanek
If you use a generator instead of a string then you'll only loop once and wait forever. On Wed, Jan 19, 2022 at 11:49 AM jerome via code-quality < [email protected]> wrote: > Hi everyone, first I'm not quite sure if this is the right place to make > this kind of suggestion/ask question but,

[code-quality] Re: could itertools.cycle not make a copy of the iterable ?

2022-01-19 Thread Jérôme Guay via code-quality
Thank you for the answer, yes I now see where the problem is. My reasoning was that in those case the responsibily should fall upon the user to make a list first instead of making a copy each time, but now I see that it can wait for ever in some cases. Sorry for posting in the wrong place !

[code-quality] Re: could itertools.cycle not make a copy of the iterable ?

2022-01-19 Thread Jérôme Guay via code-quality
Thank for the answer David, waiting forever is indeed a problem. It seems obvious now . ___ code-quality mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/code-qua