[Python-ideas] Python multi-dimensional array constructor

Sven R. Kunze srkunze at mail.de
Fri Oct 21 14:12:43 EDT 2016


On 19.10.2016 21:08, Todd wrote:
>
> a= [|||| 48, 11, 141, 13, -60, -37, 58, -52, -29, 134
>        || -6, 96, -66, 137, -59, -147, -118, -104, -123, -7
>       ||| -103, 50, -89, -12,  28, -12, 119, -131, -73, 21
>        || -58, 105, 25, -138, -106, -118, -29, -49, -63, -56
>      |||| -43, -34, 101, -115, 41, 121, 3, -117, 101, -145
>        || 100, -128, 76, 128, -113, -90, 52, -91, -72, -15
>       ||| 22, -65, -118, 134, -58, 55, -73, -118, -53, -60
>        || -85, -136, 83, -66, -35, -117, -71, 115, -56, 133
>      ||||]
>
> b = [|||| 48, 11, 141, 13, -60, -37, 58, -52, -29, 134 |
>         | -6, 96, -66, 137, -59, -147, -118, -104, -123, -7 |
>        |
>         | -103, 50, -89, -12,  28, -12, 119, -131, -73, 21 |
>         | -58, 105, 25, -138, -106, -118, -29, -49, -63, -56 |
>       ||
>         | -43, -34, 101, -115, 41, 121, 3, -117, 101, -145 |
>         | 100, -128, 76, 128, -113, -90, 52, -91, -72, -15 |
>        |
>         | 22, -65, -118, 134, -58, 55, -73, -118, -53, -60 |
>         | -85, -136, 83, -66, -35, -117, -71, 115, -56, 133 ||||]
>
>
> Compared to the current approach:
>
> a = np.ndarray([[[[48, 11, 141, 13, -60, -37, 58, -52, -29, 134],
>                   [-6, 96, -66, 137, -59, -147, -118, -104, -123, -7]],
>                  [[-103, 50, -89, -12,  28, -12, 119, -131, -73, 21],
>                   [-58, 105, 25, -138, -106, -118, -29, -49, -63, -56]]],
>                 [[[-43, -34, 101, -115, 41, 121, 3, -117, 101, -145],
>                   [100, -128, 76, 128, -113, -90, 52, -91, -72, -15]],
>                  [[22, -65, -118, 134, -58, 55, -73, -118, -53, -60],
>                   [-85, -136, 83, -66, -35, -117, -71, 115, -56, 133]]]])
>
> I think both of the new examples are considerably clearer than the 
> current approach.
>
> Does anyone have any questions or thoughts?

Honestly, all three look the same to me. Confusing, large, heavy. I'm 
sorry. :(

Best,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161021/3403938a/attachment.html>


More information about the Python-ideas mailing list