Re: can't generate iterator from list

2011-09-10 Thread Dr. Phillip M. Feldman
I just realized that there is a defect in my algorithm, so I will try to code this using a recursive algorithm instead. -- View this message in context: http://old.nabble.com/can%27t-generate-iterator-from-list-tp32435519p32439439.html Sent from the Python - python-list mailing list archive at

Re: can't generate iterator from list

2011-09-10 Thread Dr. Phillip M. Feldman
Very nice explanation! I've circumvented the problem by returning a `deepcopy` of the list. I've also added an acknowledgment. The revised code is attached. I'd like to see both balls in numbered boxes (this code) and balls in unnumbered (indistinguishable) boxes in Python's `itertools` module

Re: can't generate iterator from list

2011-09-10 Thread Peter Otten
Dr. Phillip M. Feldman wrote: > > It is supposed to be possible to generate a list representation of any > iterator that produces a sequence of finite length, but this doesn't > always work. Here's a case where it does work: > > Input: > > from itertools import combinations > list(combinations(

Re: can't generate iterator from list

2011-09-09 Thread Miki Tebeka
1. Can you post the code somewhere where it's indented properly? (http://paste.pocoo.org/) 2. In the list example you call balls_in_numbered_boxes(2, [3,3,3]) but in the interactive example you call balls_in_numbered_boxes(3,[3,3,3]) -- http://mail.python.org/mailman/listinfo/python-list