Apr-22-2019, 01:42 AM
Hello,
A newbie question on the 'how' of the array slicing syntax.
Given that,
For example,
In other words, if I were to create a NumPy-like package from scratch, what feature of Python would I use to support the colon-based syntax for slicing?
Many thanks.
Regards,
/nxs
A newbie question on the 'how' of the array slicing syntax.
Given that,
- Python does not support NumPy style arrays natively;
- NumPy is a package that you must import;
- Imported packages cannot in general extend or modify the syntax of a language;
For example,
Quote:>>> from numpy import *
>>> a = array([ [1, 2, 3], [4, 5, 6], [7, 8, 9] ])
>>> a[:, 1:3]
array([[2, 3],
[5, 6],
[8, 9]])
>>>
In other words, if I were to create a NumPy-like package from scratch, what feature of Python would I use to support the colon-based syntax for slicing?
Many thanks.
Regards,
/nxs