Carsten Haese <[EMAIL PROTECTED]> writes:
> ...
> That's not the Fibonacci sequence.
Bah, you're right of course, I should be more more careful before
posting these things.
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 2007-09-25 at 10:41 +0100, Paul Rudin wrote:
> Going off on a tangent a bit, but I was idly considering the absence
> of itertools.ireduce the other day. A problem is that reduce gives a
> single result, so it's not clear what ireduce would do (perhaps why
> it's not there). One obvious can
Ben Finney <[EMAIL PROTECTED]> writes:
>
> If, instead, it makes sense for the results to be iterated over, you
> can write a function that yields results one at a time, without
> necessarily knowing in advance what the entire set will be::
>
> >>> def fib(max_result):
Going off on a tangent
Shriphani <[EMAIL PROTECTED]> writes:
> If I have a function that loops over a few elements and is expected to
> throw out a few tuples as the output, then what should I be using in
> place of return ?
If it makes sense for the set of results to be returned all at once,
then return the object tha
Shriphani wrote:
> If I have a function that loops over a few elements and is expected to
> throw out a few tuples as the output, then what should I be using in
> place of return ?
Use a generator and have it /yield/ rather than /return/ results:
>>> def f(items):
... for item in items:
...
hello all,
If I have a function that loops over a few elements and is expected to
throw out a few tuples as the output, then what should I be using in
place of return ?
Shriphani Palakodety.
--
http://mail.python.org/mailman/listinfo/python-list