Re: it doesn't work ;) [class recursive function]

2010-09-17 Thread MRAB

On 17/09/2010 17:55, Ethan Furman wrote:

MRAB wrote:

On 16/09/2010 00:23, Ethan Furman wrote:


I need some fresh eyes, or better brains, or both!


'next_item' is a generator, but it's just calling itself and discarding
the result. I think it should be yielding the results to its caller.
That fix gives me 7 sections in total.


Thanks, M!

Some further reading on generators has helped clarify the issue for me.
I had forgotten that the initial call to a generator only sets it up,
and then returns the generator function itself, which then needs to be
iterated through.

Thanks for the reminder!

--
~Ethan~

Still early in the morning for me, so just in case I didn't phrase it
well, my thanks are sincere.

PS
My apologies if this shows up twice, I haven't seen my other post yet
and it's been 27 hours.


That's probably because you sent it directly to me.
--
http://mail.python.org/mailman/listinfo/python-list


Re: it doesn't work ;) [class recursive function]

2010-09-17 Thread Ethan Furman

MRAB wrote:

On 17/09/2010 17:55, Ethan Furman wrote:

MRAB wrote:

On 16/09/2010 00:23, Ethan Furman wrote:


PS
My apologies if this shows up twice, I haven't seen my other post yet
and it's been 27 hours.


That's probably because you sent it directly to me.


That would explain it -- like I said, it was still early for me!  :)

--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: it doesn't work ;) [class recursive function]

2010-09-15 Thread MRAB

On 16/09/2010 00:23, Ethan Furman wrote:

I need some fresh eyes, or better brains, or both!

The expected debugging output is a list of names in alphabetical order
from each node (there are about 90 of them); what I am getting is this:

-- dbf.tables.Index.from_file('', r'aad13658_last_name_for_state.idx')

starting next_item call for root
-
open file 'aad13658_last_name_for_state.idx', mode 'rb' at 0x013BD458
512 30
-
more nodes
CARNAHAN 1536
ENGLUND 1024
HOLSTEIN 2048
MATTHEWS 2560
ROSENFELD 3072
TERWILLIGER 3584
YAZZOLINO 4096

and then it stops. I should get about nine of these sections, and I'm
only getting one.

code snippet


[snip code]


/code snippet

Any ideas appreciated!


'next_item' is a generator, but it's just calling itself and discarding
the result. I think it should be yielding the results to its caller.
That fix gives me 7 sections in total.
--
http://mail.python.org/mailman/listinfo/python-list