Re: frange() question

2007-09-22 Thread Carsten Haese
On Sat, 2007-09-22 at 18:21 +, John J. Lee wrote: > Carsten Haese <[EMAIL PROTECTED]> writes: > > The second half of my post illustrates a difference of opinion about > > what constitutes a generator function. You state that frange() is not a > > generator function because it doesn't use yield,

Re: frange() question

2007-09-22 Thread John J. Lee
Carsten Haese <[EMAIL PROTECTED]> writes: > On Sat, 2007-09-22 at 07:27 +, John J. Lee wrote: >> Carsten Haese <[EMAIL PROTECTED]> writes: >> >> > On Thu, 2007-09-20 at 18:55 +, John J. Lee wrote: >> >> Functions are never generators, senso stricto. There are "generator >> >> functions",

Re: frange() question

2007-09-22 Thread Carsten Haese
On Sat, 2007-09-22 at 07:27 +, John J. Lee wrote: > Carsten Haese <[EMAIL PROTECTED]> writes: > > > On Thu, 2007-09-20 at 18:55 +, John J. Lee wrote: > >> Functions are never generators, senso stricto. There are "generator > >> functions", which *return* (or yield) generators when you cal

Re: frange() question

2007-09-22 Thread John J. Lee
Carsten Haese <[EMAIL PROTECTED]> writes: > On Thu, 2007-09-20 at 18:55 +, John J. Lee wrote: >> Functions are never generators, senso stricto. There are "generator >> functions", which *return* (or yield) generators when you call them. > > Actually, a generator function is a function that re

Re: frange() question

2007-09-21 Thread Michael J. Fromberger
In article <[EMAIL PROTECTED]>, George Trojan <[EMAIL PROTECTED]> wrote: > A while ago I found somewhere the following implementation of frange(): > > def frange(limit1, limit2 = None, increment = 1.): > """ > Range function that accepts floats (and integers). > Usage: > fran

Re: frange() question

2007-09-20 Thread Carsten Haese
On Thu, 2007-09-20 at 18:55 +, John J. Lee wrote: > Functions are never generators, senso stricto. There are "generator > functions", which *return* (or yield) generators when you call them. Actually, a generator function is a function that returns a generator. The generator, in turn, is an o

Re: frange() question

2007-09-20 Thread John J. Lee
George Trojan <[EMAIL PROTECTED]> writes: > A while ago I found somewhere the following implementation of frange(): > > def frange(limit1, limit2 = None, increment = 1.): > """ > Range function that accepts floats (and integers). > Usage: > frange(-2, 2, 0.1) > frange(10) >

Re: frange() question

2007-09-20 Thread Stargaming
On Thu, 20 Sep 2007 09:08:17 -0400, George Trojan wrote: > A while ago I found somewhere the following implementation of frange(): > > def frange(limit1, limit2 = None, increment = 1.): > """ > Range function that accepts floats (and integers). Usage: > frange(-2, 2, 0.1) > fr

Re: frange() question

2007-09-20 Thread Tim Golden
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 generato

frange() question

2007-09-20 Thread George Trojan
A while ago I found somewhere the following implementation of frange(): def frange(limit1, limit2 = None, increment = 1.): """ Range function that accepts floats (and integers). Usage: frange(-2, 2, 0.1) frange(10) frange(10, increment = 0.5) The returned value i