You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The LazyRepeater is intended for a re-iterable Iterable.
If the iterable is not re-iterable, for example, if it is a generator created by a generator expression or the yield keyword, then iterating on the LazyRepeater would hang indefinitely without yielding any real items when times is not specified, or it would yield fewer items than the user expected if times > 1.
Add a "re-iterable" and "non-empty" restriction for the input iterable in the docstring.
Whenever an epoch starts, if the very first yield statement raises a StopIteration error, then raise an Exception complaining about "not being non-empty" and "not being re-iterable" (for the second and later epochs only).
Change the parameter name from 'iterator' to 'iterable' (however, this may cause backward compatibility issues).
The text was updated successfully, but these errors were encountered:
The
LazyRepeater
is intended for a re-iterableIterable
.If the
iterable
is not re-iterable, for example, if it is a generator created by a generator expression or theyield
keyword, then iterating on theLazyRepeater
would hang indefinitely without yielding any real items whentimes
is not specified, or it would yield fewer items than the user expected iftimes > 1
.Here is a simple reproduction of the issue:
My proposed solution:
The text was updated successfully, but these errors were encountered: