In article <[EMAIL PROTECTED]>, "Kay Schluehr" <[EMAIL PROTECTED]> writes: |> |> You might use a separate prime generator to produce prime factors. The |> factorize algorithm becomes quite simple and configurable by prime |> generators. For demonstration purposes I use the eratosthenes sieve.
That is a good point. The differences between iteration and recursion are well-understood (by some people, at least), but the difference between those two and generators is not. I have mixed feelings whether they are a good idea or not, largely because I have never seen a language that provides a declaration to guarantee that a generator is 'clean'. And an unclean generator (e.g. one with side-effects) is a most revolting object, from a software engineering (including validation) point of view. One good example of this is streaming input (I/O). Traditional, clean streaming input can be implemented efficiently and with good error diagnostics. The unclean C- and POSIX-like streaming input can't be, or at least only one of the two can be provided at once. Regards, Nick Maclaren. -- http://mail.python.org/mailman/listinfo/python-list