[Python-ideas] Python multi-dimensional array constructor

Thomas Nyberg tomuxiong at gmx.com
Wed Oct 19 15:24:15 EDT 2016


Personally I like the way that numpy does it now better (even for 
multidimensional arrays). Being able to index into the different sub 
dimension using just [] iteratively matches naturally with the data 
structure itself in my mind. This may also just be my fear of change 
though...

> Here is an example of how it would be used for a 1D array:
>
> a = [| 0, 1, 2 |]
>
> Compared to the current approach:
>
> a = np.ndarray([0, 1, 2])

What would the syntax do if you don't have numpy installed? Is the 
syntax tied to numpy or could other libraries make use of it?

Cheers,
Thomas


More information about the Python-ideas mailing list