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
|
if step is not None and stop is not None: |
|
if step < 0: |
|
start, stop = stop, start - 1 |
|
else: |
|
start, stop = start, stop + 1 |
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)
Hi!
produces an exception
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'The problem is here, in line 43
from-python-to-numpy/code/find_index.py
Lines 41 to 45 in eb21651
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: