<div><div dir="auto">@D’aprano I think you’re misleading by what I said, sorry for not being crystal clear. </div></div><div dir="auto"><br></div><div dir="auto">I just read the link on Julia (which I didn’t do) and I get what you mean now and it’s not quite different from what I said. </div><div dir="auto"><br></div><div dir="auto">I proposed introducing a new type : « vector » </div><div dir="auto">A few steps have been made in Python for typing and I think the next step is having typed collections. Keeping with nothing checked is better imo. </div><div dir="auto">So if we take this next step, we’ll get a vector type with *not-guaranteed* homogeneous data. Whether its type is « object » « int » or anything else doesn’t matter as long as it’s supposed to be the same. </div><div dir="auto"><br></div><div dir="auto">This doesn’t change anything in term of usage. Of course we should/could use map and usual operators on collections. What I was then proposing, to complete what you suggested and because I don’t like the dot notation, is using the matrix-multiplication the same way it is used in Julia with the dots. </div><div dir="auto"><br></div><div dir="auto">But I have a question. I never coded anything at C-level nor a compiler, is this possible for user defined types to make the vectorieation optimized the same way it’s done with numbers in numpy ?</div><div dir="auto"><br></div><div dir="auto">If yes, I think it would benefit the community. If no, it’s less likely, though it’s pursuing the steps made with typing</div><div dir="auto"><br></div><div><div class="gmail_quote"><div dir="ltr">On Sat 2 Feb 2019 at 10:23, Kirill Balunov <<a href="mailto:kirillbalunov@gmail.com">kirillbalunov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">сб, 2 февр. 2019 г. в 07:33, Steven D'Aprano <<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
I didn't say anything about a vector type.<br>
<br></blockquote><div><br></div><div>I agree  you did not say. But since you started a new thread from the one where the vector type was a little discussed, it seemed to me  that it is appropriate to mention it here. Sorry about that.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Therefore, it allows you to ensure that the method is present for each<br>
> element in the vector. The first given example is what numpy is all about<br>
> and without some guarantee that L consists of homogeneous data it 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></blockquote><div><br></div><div>Yes, numpy, at some degree, supports heterogeneous arrays. But not in the way you brought it. Your example just shows homogeneous array of type `'|S4'`. In the same way as `np.array([1, 1.234])` will be homogeneous. Of course you can say -  np.array([1, 'spam'], dtype='object'), but in this case it will also be homogeneous array, but of type `object`.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Inhomogeneous data may rule out some optimizations, but that hardly <br>
means that it "doesn't make sense" to use it.<br></blockquote><div><br></div><div>I did not say that it  "doesn't make sense". I only said that you should be lucky to call `..method()` on collections of heterogeneous data. And therefore, usually this kind of operations imply that you are working with a "homogeneous data". Unfortunately, built-in containers cannot provide such a guarantee without self-checking. Therefore, in my opinion that at the moment such an operator is not needed.</div><div><br></div><div>With kind regards,</div><div>-gdg</div><div> </div></div></div></div></div></div></div></div></div>
_______________________________________________<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></div>