upstream code (see scipy/scipy#21074). The standard does not define iteration, but it does define __getitem__, and the default Python __iter__ implements iteration when getitem is defined as a[0], a[1], ..., implying that iteration ought to work for 1-D arrays. Iteration is still disallowed for higher dimensional arrays, since getitem would not necessarily work with a single integer index (and this is the case that is controversial). In those cases, the new unstack() function would be preferable.
At best it would be good to get upstream clarification from the standard whether iteration should always work or not before disallowing 1-D array iteration.
upstream code (see scipy/scipy#21074). The standard does not define iteration, but it does define
__getitem__
, and the default Python__iter__
implements iteration when getitem is defined as a[0], a[1], ..., implying that iteration ought to work for 1-D arrays. Iteration is still disallowed for higher dimensional arrays, since getitem would not necessarily work with a single integer index (and this is the case that is controversial). In those cases, the new unstack() function would be preferable.At best it would be good to get upstream clarification from the standard whether iteration should always work or not before disallowing 1-D array iteration.