Playing with the NumPy concatenation and range building object r_
I stumbled over the following behavior: apparently, a complex step no matter whether real, imaginary or proper complex has its absolute value taken as the number of steps in a linspace
like way.
>>> import numpy as np
>>>
>>> np.r_[0:12:4] # start : stop : step
array([0, 4, 8]) # that's expected
>>> np.r_[0:12:4j] # start : stop : imaginary step
array([ 0., 4., 8., 12.]) # that's in the docs
>>> np.r_[0:12:4+0j] # real step of complex type ?
array([ 0., 4., 8., 12.]) # this is not as far as I can tell
# you can even do stuff like
>>> np.r_[0:12:-4+3j] # proper complex step ?
array([ 0., 3., 6., 9., 12.])
Question: I just wanted to know whether that's an official feature, because I couldn't find it documented.
Why is it relevant? Well, r_
primarily being a keystroke saving convenience there are a few cases where this feature could save you a few characters.