22.07.18 22:03, Todd пише:
For basic slices, the normal "slice(start, stop, step)" syntax works
well. But it becomes much more verbose to create more complicated
slices that you want to re-use for multiple multidimensional data
structures, like numpy, pandas, xarray, etc.
One idea I had was to allow creating slices by using indexing on the
slice class. So for example:
x = slice[5:1:-1, 10:20:2, 5:end]
Would be equivalent to:
x = (slice(5, 1, -1), slice(10, 20, 2), slice(5, None))
Note that this wouldn't be done on a slice instance, it would be done on
the slice class. The basic idea is that it would simply return whatever
is given to __getitem__.
See https://bugs.python.org/issue24379 .
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/