<div dir="ltr">I personally would the first option to be the case. But then vectors shouldn't be list-like but more generator like.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 2 févr. 2019 à 19:26, MRAB <<a href="mailto:python@mrabarnett.plus.com">python@mrabarnett.plus.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2019-02-02 09:22, Kirill Balunov wrote:<br>
> <br>
> <br>
> сб, 2 февр. 2019 г. в 07:33, Steven D'Aprano <<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a> <br>
> <mailto:<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>>>:<br>
> <br>
> <br>
> I didn't say anything about a vector type.<br>
> <br>
> <br>
> I agree you did not say. But since you started a new thread from the <br>
> one where the vector type was a little discussed, it seemed to me that <br>
> it is appropriate to mention it here. Sorry about that.<br>
> <br>
> > Therefore, it allows you to ensure that the method is present for<br>
> each<br>
> > element in the vector. The first given example is what numpy is<br>
> all about<br>
> > and without some guarantee that L consists of homogeneous data it<br>
> hardly<br>
> > make sense.<br>
> <br>
> Of course it makes sense. Even numpy supports inhomogeneous data:<br>
> <br>
> py> a = np.array([1, 'spam'])<br>
> py> a<br>
> array(['1', 'spam'],<br>
> dtype='|S4')<br>
> <br>
> <br>
> Yes, numpy, at some degree, supports heterogeneous arrays. But not in <br>
> the way you brought it. Your example just shows homogeneous array of <br>
> type `'|S4'`. In the same way as `np.array([1, 1.234])` will be <br>
> homogeneous. Of course you can say - np.array([1, 'spam'], <br>
> dtype='object'), but in this case it will also be homogeneous array, but <br>
> of type `object`.<br>
> <br>
> Inhomogeneous data may rule out some optimizations, but that hardly<br>
> means that it "doesn't make sense" to use it.<br>
> <br>
> <br>
> I did not say that it "doesn't make sense". I only said that you should <br>
> be lucky to call `..method()` on collections of heterogeneous data. And <br>
> therefore, usually this kind of operations imply that you are working <br>
> with a "homogeneous data". Unfortunately, built-in containers cannot <br>
> provide such a guarantee without self-checking. Therefore, in my opinion <br>
> that at the moment such an operator is not needed.<br>
> <br>
Here's a question: when you use a subscript on a vector, does it apply <br>
to the vector itself, or its members?<br>
<br>
For example, given:<br>
<br>
>>> my_strings = Vector(['one', 'two', 'three'])<br>
<br>
what is:<br>
<br>
>>> my_strings[1 : ]<br>
<br>
?<br>
<br>
Is it:<br>
<br>
Vector(['ne', 'wo', 'hree'])<br>
<br>
or:<br>
<br>
Vector(['two', 'three'])<br>
<br>
?<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div>