On 10/19/2016 12:08 PM, Todd wrote:

At least in my opinion, this sort of approach really shines when making
 higher-dimensional arrays.  These would all be equivalent (the | at the
 beginning and end are just to make it easier to align indentation, they
 aren't required):

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?

Optional, semi-meaningless, not-really-an-operator markings?  The current 
approach I could at least figure out if I had to -- yours is confusing.

You have done a good job explaining what you mean, but what to you is clear is 
to me, and others, incomprehensible.

--
~Ethan~
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to