(There is also the original benefit discussed in #8450 
<https://github.com/JuliaLang/julia/issues/8450>: when you write a function 
f(x::Number), you don't have to decide in advance whether you need a 
separate "vector" version of it too.  You can just write f.(x) for any 
scalar function f.)

Note that all of this is not really an option in Python or NumPy, because 
Python loops are too slow — for performance, they must decide in *advance* 
which loops they want to vectorize, and implement those in C/Cython/etc.   
There are also various code-generation/JIT frameworks for NumPy that can 
fuse NumPy loops, but again they can only fuse a set of NumPy operations 
that are selected in advance, not arbitrary user-defined functions.    In 
consequence, in Python there is not as much practical benefit to be gained 
from a syntactic broadcast.

Reply via email to