Open fat-crocodile opened 1 year ago
Hi!
Z = base[6:2:-1, 5::-1] find_index(base, Z)
produces an exception
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
The problem is here, in line 43 https://github.com/rougier/from-python-to-numpy/blob/eb21651fc84d132414603e5a16d93f54ef45ec99/code/find_index.py#L41-L45
We've checked that stop is not None, but step is less than zero and we didn't check start, BOOM!
I suggest code like this:
if step is not None: if step < 0: start, stop = stop, start if stop is not None: stop += np.sign(step)
Sorry for late reply. You mean your fix solve the problem ? Could you make a PR?
Hi!
produces an exception
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
The problem is here, in line 43 https://github.com/rougier/from-python-to-numpy/blob/eb21651fc84d132414603e5a16d93f54ef45ec99/code/find_index.py#L41-L45
We've checked that stop is not None, but step is less than zero and we didn't check start, BOOM!
I suggest code like this: