len(v) # -> 12
In this case you can apply any function, even custom_linked_list from my_inhouse_module.py.
v[len] # -> <Vector of [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]>
I think I really like this idea. Maybe as an extra spelling but still allow .apply() to do the same thing. It feels reasonably intuitive to me. Not *identical to* indexing in NumPy and Pandas, but sort of in the same spirit as predicative or selection based indices.
What do other people on this thread think? Would you learn that easily? Could you teach it?
<Vector of ['Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']>
>>> v[i[1:]] # some helper class `i`
<Vector of ['an', 'eb', 'ar', 'pr', 'ay', 'un', 'ul', 'ug', 'ep', 'ct', 'ov', 'ec']>
This feels more forced, unfortunately. Something short would be good, but not sure I like this. This is really just a short spelling of pandas.IndexSlice or numpy.s_ It came up in another thread some months ago, but there is another proposal to allow the obvious spelling `slice[start:stop:sep]` as a way of creating slices.
Actually, I guess that's all halfway for the above. We'd need to do this still: