[SciPy-user] diff function, different from MatLab ...

Stef Mientki s.mientki at ru.nl
Wed May 9 06:22:28 EDT 2007


hello,

Coming from MatLab, it's very nice to see the better perfomance / 
optimization of SciPy,
especially views instead of copies and taking the smallest result for a 
new variable.

But sometimes, I wonder ...
... why ?

F = False
T = True
s = asarray ( [ F, F, F, T, T, T, F,F ] )
d = diff ( s )
print d
 >>> d = ( [ F, F, T, F, F, T, F ] )

why not:
 >>> d = ( [ 0, 0, 1, 0, 0, -1, 0 ] )

which can be achieved by
d = diff (1 * s )

thanks,
Stef Mientki



More information about the SciPy-User mailing list