Nice that you implemented it !
I think all the issues you have right now would go of using another operation. I proposed the @ notation that is clear and different from everything else,
plus the operator is called "matmul" so it completely makes sense. The the examples would be :
>>> l = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split()
>>> v = Vector(l)
>>> len(v)
12
>>> v @ len
<Vector of [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]>
>>> list(v)
["Jan", "Feb", "Mar", "Apr", "May", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
>>> v @ list
<Vector of [["J", "a", "n"], ["F", "e", "b"], ["M", "a", "r"], ["A", "p", "r"], ["M", "a", "y"], ...]
We still have some issues : how to we treat operators like v[1:].
I suggest using the same syntax : if we don't use @ the operation is done on the vector and not on its elements. Therefore,
v[1:] will remove "Jan" from the vector whereas v @ operator.getitem(slice
>>> from functools import partial
>>> import operator
>>> v[1:]
<Vector of ['Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']>
>>> my_slice = slice(1, None, None)
>>> indexing_operation = partial(operator.getitem(my_slice))
>>> v @ indexing_operation
<Vector of ['an', 'eb', 'ar', 'pr', 'ay', 'un', 'ul', 'ug', 'ep', 'ct', 'ov', 'ec']>
That little example shows the need of configuring functions so they only accept on argument.
It's actually not a new problem since map have the same "issue".
A vector of one element should still be a vector, as a list/tuple/dict of one element is a list/tuple/dict, imo.
I suggested Vector objects to inherit from lists, and therefore be iterables. It would be handy to iterator over
its elements and simple loops, maps, etc, should still be available to them. It might be clearer to use "old" notations
for some operations.
About the `Vector("A Super String")`, if we want it to be a vector of one element, we should use `Vector(["A Super String"])`,
as we would do in any other function using an iterable as input.
Side Note :
Honestly, I don't think it's the good thread to debate whether we should use ["in", "un", "an", "non"] - homogeneous or heterogeneous.
As long as it's clear, does it matter ?