Re: Generalized range

2007-04-27 Thread Alex Martelli
Beliavsky <[EMAIL PROTECTED]> wrote: ... > > I've taught "numerical computing" in university, and I would have had to > > fail anybody who'd misunderstood floating-point computations badly > > enough to try that "+=step" idea (including, sigh, the coders of several > > Fortran compilers who were

Re: Generalized range

2007-04-27 Thread Beliavsky
On Apr 27, 1:32 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > Michael Hoffman <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > > Thanks - you have covered a fair bit of gorund here - I will modify > > > myRange taking your suggestions into account. The one suggestion that > > > I'm goin

Re: Generalized range

2007-04-26 Thread Alex Martelli
Michael Hoffman <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Thanks - you have covered a fair bit of gorund here - I will modify > > myRange taking your suggestions into account. The one suggestion that > > I'm going to have to think through is repeatedly incrementing res. > > > > I

Re: Generalized range

2007-04-26 Thread Michael Hoffman
Michael Hoffman wrote: > How about something like this: > > index = 0 > while res < maximum: > yield minimum + (step * index) > index += 1 Well it really would have to be something LIKE that since I never defined res. Let's try that again: index = 0 res = minimum while res < maximum:

Re: Generalized range

2007-04-26 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: > Thanks - you have covered a fair bit of gorund here - I will modify > myRange taking your suggestions into account. The one suggestion that > I'm going to have to think through is repeatedly incrementing res. > > I deliberately did not use this as repeated addition can c

Re: Generalized range

2007-04-26 Thread tkpmep
Thanks - you have covered a fair bit of gorund here - I will modify myRange taking your suggestions into account. The one suggestion that I'm going to have to think through is repeatedly incrementing res. I deliberately did not use this as repeated addition can cause rounding errors to accumulate,

Re: Generalized range

2007-04-26 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: > I need to create ranges that can start and end with real numbers. > Searching this newsgroup brought me to a function that I then modified > as follows: > > def myRange(iMin, iMax=None, iStep=1): > """Extends range to real numbers. Wherever possible, use Python's > r

Re: Generalized range

2007-04-26 Thread Stargaming
[EMAIL PROTECTED] schrieb: > I need to create ranges that can start and end with real numbers. > Searching this newsgroup brought me to a function that I then modified > as follows: > > def myRange(iMin, iMax=None, iStep=1): Just as a sidenote: it is not common to prefix your names with its type.

Generalized range

2007-04-26 Thread tkpmep
I need to create ranges that can start and end with real numbers. Searching this newsgroup brought me to a function that I then modified as follows: def myRange(iMin, iMax=None, iStep=1): """Extends range to real numbers. Wherever possible, use Python's range . In other cases, make the