3 ms·
Wouldn't adding goland-style slices to Python be awesome?
by YesThatTom2 14y ago
Wouldn't adding goland-style slices to Python be awesome?
- kkuduk 14y agowell, there are memoryviews, but they could have been designed better
- travisoliphant 14y agoMemoryviews are the step-child of NumPy arrays. The buffer-protocol was the real intent and the memory view the forgotten "example" until a few brave and noble Python devs rescued it from obscurity. Memory-views are not that useful to one who will always have NumPy installed.
- almost 14y agoIt's not quite the same but some of the use cases (and a bunch of other stuff) would be covered by numpy arrays. You can create multiple views on the same in memory data with different start and end points and different strides.
- dagw 14y agoAgreed. I think numpy arrays a rather overlooked by most python programmers. They allow all kinds of useful tricks like that that are quite handy even if you're not doing strictly numeric work.