[Francis Girard] > ... > In the meantime, I couldn't resist to test the new Python features about > laziness on a classical FP problem, i.e. the "Hamming" problem. ... > Nevertheless, while the Haskell version prints Hamming sequence for as long as > I can stand it, and with very little memory consumation, the Python version > only prints : ... > I think I should not have this kind of behaviour, even using recursion, since > I'm only using lazy constructs all the time. At least, I would expect the > program to produce much more results before surrending. > > What's going on ?
You can find an explanation in Lib/test/test_generators.py, which uses this problem as an example; you can also find one efficient way to write it there. -- http://mail.python.org/mailman/listinfo/python-list