Dr. Phillip M. Feldman wrote: > When I run my code, I get the same 14 configurations that your code > produces;
I'm sorry, I ran the buggy code from http://old.nabble.com/file/p32439307/balls_in_numbered_boxes.py without realizing it was not http://old.nabble.com/file/p32440187/balls_in_numbered_boxes.py > the only different that I can see in the output is that the > configurations are produced in a different order. Note that your code is > not creating an iterator, so thus doesn't do what I want. The outer loop is in a generator expression and thus evaluates lazily. > Also, > generating the product set and then testing whether the total number of > balls is correct will potentially consider a huge number of cases that > must be rejected because the sum is wrong; this is too inefficient. Indeed; I should have added a disclaimer to make that clear. -- http://mail.python.org/mailman/listinfo/python-list