Commit 0a4813e
committed
Allow iteration on 1-D arrays
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.1 parent 1edb7b0 commit 0a4813e
2 files changed
+18
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
684 | 690 | | |
685 | 691 | | |
686 | 692 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
423 | 425 | | |
424 | 426 | | |
425 | 427 | | |
426 | | - | |
427 | | - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
428 | 434 | | |
429 | 435 | | |
430 | 436 | | |
| |||
0 commit comments