MATLAB to Python?

Chris Rebert clp2 at
Mon Nov 22 10:05:21 CET 2010

On Mon, Nov 22, 2010 at 12:47 AM, MATLABdude <matlab.dude at> wrote:
> On Nov 17, 10:53 am, Arnaud Delobelle <arno... at> wrote:
>> I guess that the step is supposed to be h, so you should write:
>>     xx = range(-kappa, kappa+1, h)
> This is what I have in the source code:
> ---8<---8<---8<---8<---
> h =  0.105069988414
> xx = range(-kappa, kappa+1, h)
> ---8<---8<---8<---8<---
> This is what Python says: ValueError: range() step argument must not
> be zero
> Can step not be a float value?

Correct. Note the DeprecationWarning which is also shown:
__main__:1: DeprecationWarning: integer argument expected, got float

There are too many subtleties with floating-point, so range() doesn't
handle it; that way, you deal with the subtleties yourself,


More information about the Python-list mailing list