On Jul 27, 10:47 pm, Terry Reedy wrote:
> There are two possible definition of 'exhausted': 1) will raise
> StopIteration on the next next() call; 2) has raised StopIteration at
> least once. The wrapper converts 2) to 1), which is to say, it obeys
> definition 1 once the underlying iteration has
Steven D'Aprano wrote:
On Mon, 27 Jul 2009 02:02:19 -0400, Terry Reedy wrote:
Steven D'Aprano wrote:
On Sun, 26 Jul 2009 20:10:00 -0400, Terry Reedy wrote:
Michal Kwiatkowski wrote:
The thing is I don't need the next item. I need to know if the
generator has stopped without invoking it.
W
In article <1c8ae01e-2e9c-497c-9f8d-408f56f9c...@g31g2000yqc.googlegroups.com>,
Michal Kwiatkowski wrote:
>On Jul 27, 1:56 am, a...@pythoncraft.com (Aahz) wrote:
Upon a cursory look, after a generator 'gen' is exhausted (meaning
gen.next() has raised StopIteration), it seems that gen.gi
On Jul 27, 1:56 am, a...@pythoncraft.com (Aahz) wrote:
> >> Upon a cursory look, after a generator 'gen' is exhausted (meaning
> >> gen.next() has raised StopIteration), it seems that gen.gi_frame will be
> >> None.
>
> >Only in Python 2.5 or higher though. I need to support Python 2.3 and
> >2.4 a
On Mon, 27 Jul 2009 02:02:19 -0400, Terry Reedy wrote:
> Steven D'Aprano wrote:
>> On Sun, 26 Jul 2009 20:10:00 -0400, Terry Reedy wrote:
>>
>>> Michal Kwiatkowski wrote:
>>>
The thing is I don't need the next item. I need to know if the
generator has stopped without invoking it.
>>> Wr
Steven D'Aprano wrote:
On Sun, 26 Jul 2009 20:10:00 -0400, Terry Reedy wrote:
Michal Kwiatkowski wrote:
The thing is I don't need the next item. I need to know if the
generator has stopped without invoking it.
Write a one-ahead iterator class, which I have posted before, that sets
.exhausted
On Sun, 26 Jul 2009 20:10:00 -0400, Terry Reedy wrote:
> Michal Kwiatkowski wrote:
>
>> The thing is I don't need the next item. I need to know if the
>> generator has stopped without invoking it.
>
> Write a one-ahead iterator class, which I have posted before, that sets
> .exhausted to True wh
Michal Kwiatkowski wrote:
The first generator isn't finished, it yielded 1 and None. Second one
is exhausted after yielding a single value (1). The problem is that,
under Python 2.4 or 2.3 both invocations will generate the same trace
output.
This seems to be a deficiency in the trace mechanis
Michal Kwiatkowski wrote:
The thing is I don't need the next item. I need to know if the
generator has stopped without invoking it.
Write a one-ahead iterator class, which I have posted before, that sets
.exhausted to True when next fails.
tjr
--
http://mail.python.org/mailman/listinfo/pyt
In article <2a408da6-af57-45d0-a75f-4cbe384bb...@s15g2000yqs.googlegroups.com>,
Michal Kwiatkowski wrote:
>On Jul 25, 10:00=A0pm, Jason Tackaberry wrote:
>> On Sat, 2009-07-25 at 11:30 -0700, Michal Kwiatkowski wrote:
>>>
>>> Is there a way to tell if a generator has been exhausted using pure
>>
On Jul 26, 1:10 am, Ben Finney wrote:
> Michal Kwiatkowski writes:
> > I may be missing something obvious here. Is there a better way to tell
> > if a given generator object is still active or not?
>
> foo = the_generator_object
> try:
> do_interesting_thing_that_needs(foo.next())
On Saturday 25 July 2009 20:30:54 Michal Kwiatkowski wrote:
> Hi,
>
> Is there a way to tell if a generator has been exhausted using pure
> Python code? I've looked at CPython sources and it seems that
> something like "active"/"exhausted" attribute on genobject is missing
> from the API. For the t
Michal Kwiatkowski writes:
> I may be missing something obvious here. Is there a better way to tell
> if a given generator object is still active or not?
foo = the_generator_object
try:
do_interesting_thing_that_needs(foo.next())
except StopIteration:
generator_is_exh
On Jul 25, 10:00 pm, Jason Tackaberry wrote:
> On Sat, 2009-07-25 at 11:30 -0700, Michal Kwiatkowski wrote:
> > Is there a way to tell if a generator has been exhausted using pure
> > Python code? I've looked at CPython sources and it seems that
>
> Upon a cursory look, after a generator 'gen' is
On Sat, 2009-07-25 at 11:30 -0700, Michal Kwiatkowski wrote:
> Is there a way to tell if a generator has been exhausted using pure
> Python code? I've looked at CPython sources and it seems that
Upon a cursory look, after a generator 'gen' is exhausted (meaning
gen.next() has raised StopIteration)
Hi,
Is there a way to tell if a generator has been exhausted using pure
Python code? I've looked at CPython sources and it seems that
something like "active"/"exhausted" attribute on genobject is missing
from the API. For the time being I am using a simple C extension to
look at f_stacktop pointer
16 matches
Mail list logo