On 2019-02-03 02:03, David Mertz wrote:
Slightly more on my initial behavior:

     >>> Vector({1:2,3:4})
    TypeError: Ambiguity vectorizing a map, perhaps try it.keys(),
    it.values(), or it.items()

     >>> Vector(37)
    TypeError: Vector can only be initialized with an iterable

     >>> Vector("hello")
    <Vector of 'hello'>


I'm wondering if maybe making a vector out of a scalar should simply be a length-one vector. What do you think?

Also, should a single string be treated like a vector of characters or like a scalar? It feels kinda pointless to make a vector of characters since I cannot think of anything it would do better than a plain string already does (largely just the same thing slower).

[snip]
I think it should follow the pre-existing behaviour of list, set, tuple, etc.

>>> Vector("hello")
<Vector of ['h', 'e', 'l', 'l', 'o']>

Why is it pointless for a vector, but not for a list?
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to