On 8/22/2019 11:35 AM, Dennis Lee Bieber wrote:
On Wed, 21 Aug 2019 12:52:44 -0700, Tobiah declaimed the
following:
I see. What is an example of an iterable that is not reusable?
Essentially all iterators, which included all generators, which includes
the return from all generator functio
On Fri, Aug 23, 2019 at 1:41 AM Dennis Lee Bieber wrote:
>
> On Wed, 21 Aug 2019 12:52:44 -0700, Tobiah declaimed the
> following:
>
> >
> >I see. What is an example of an iterable that is not reusable?
>
>
> >>> x = range(5)
> >>> x
> range(0, 5)
> >>>
>
>>> x = range(0, 5)
>>> list(x)
[0, 1,
On 8/21/2019 2:27 PM, Tobiah wrote:
In the docs for itertools.cycle() there is
a bit of equivalent code given:
def cycle(iterable):
# cycle('ABCD') --> A B C D A B C D A B C D ...
saved = []
for element in iterable:
yield element
saved.ap
On Thu, Aug 22, 2019 at 6:55 AM Dan Sommers
<2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 8/21/19 2:32 PM, Calvin Spealman wrote:
> > The point is to demonstrate the effect, not the specific implementation.
>
> Once you've gone through the iterable once, it's falsey,
> which means that the whi
On 8/21/19 2:32 PM, Calvin Spealman wrote:
The point is to demonstrate the effect, not the specific implementation.
Once you've gone through the iterable once, it's falsey,
which means that the while loop will end. But if you copy
all the elements to a real list, then the while loop is
infinit
On Wed, Aug 21, 2019 at 12:36 PM Calvin Spealman
wrote:
>
> The point is to demonstrate the effect, not the specific implementation.
But still yes, that's pretty much exactly what it does. The main difference
between the "roughly equivalent to" code and the actual implementation is
that the forme
On Thu, Aug 22, 2019 at 5:56 AM Tobiah wrote:
>
> On 8/21/19 11:38 AM, Rob Gaddi wrote:
> > On 8/21/19 11:27 AM, Tobiah wrote:
> >> In the docs for itertools.cycle() there is a bit of equivalent code
> >> given:
> >>
> >> def cycle(iterable): # cycle('ABCD') --> A B C D A B C D A B C D
> >> ... sa
On 2019-08-21 11:27, Tobiah wrote:
> In the docs for itertools.cycle() there is
> a bit of equivalent code given:
>
> def cycle(iterable):
> # cycle('ABCD') --> A B C D A B C D A B C D ...
> saved = []
> for element in iterable:
> yield element
>
On 8/21/19 11:38 AM, Rob Gaddi wrote:
On 8/21/19 11:27 AM, Tobiah wrote:
In the docs for itertools.cycle() there is a bit of equivalent code
given:
def cycle(iterable): # cycle('ABCD') --> A B C D A B C D A B C D
... saved = [] for element in iterable: yield element
saved.append(element) while
On 8/21/19 11:27 AM, Tobiah wrote:
In the docs for itertools.cycle() there is
a bit of equivalent code given:
def cycle(iterable):
# cycle('ABCD') --> A B C D A B C D A B C D ...
saved = []
for element in iterable:
yield element
saved.app
The point is to demonstrate the effect, not the specific implementation.
On Wed, Aug 21, 2019 at 2:30 PM Tobiah wrote:
> In the docs for itertools.cycle() there is
> a bit of equivalent code given:
>
> def cycle(iterable):
> # cycle('ABCD') --> A B C D A B C D A B C D ...
>
In the docs for itertools.cycle() there is
a bit of equivalent code given:
def cycle(iterable):
# cycle('ABCD') --> A B C D A B C D A B C D ...
saved = []
for element in iterable:
yield element
saved.append(element)
while saved:
12 matches
Mail list logo