frange() question
Tim Golden
mail at timgolden.me.uk
Thu Sep 20 09:21:51 EDT 2007
George Trojan wrote:
> A while ago I found somewhere the following implementation of frange():
.
.
.
> return (limit1 + n*increment for n in range(count))
>
> I am puzzled by the parentheses in the last line. Somehow they make
> frange to be a generator:
> But I always thought that generators need a keyword "yield". What is
> going on here?
That's what's known as a generator expression:
http://docs.python.org/ref/genexpr.html
http://www.python.org/dev/peps/pep-0289/
TJG
More information about the Python-list
mailing list