On Mon, Dec 27, 2021 at 4:07 PM Steven D'Aprano

> Julia (if I recall correctly) has a nice syntax for automatically
> turning any function or method into an element-wise function:


And numpy has an even easier one:

np.log(a_scalar)

np.log(an_array)

I’m only being a little bit silly.

In fact, array-oriented operations are really nifty, a heck of a lot easier
to parse than map, or comprehensions, etc.

Filtering can be a bit ugly, but not too bad.

MATLAB has a duplicate set of operators: the matrix ones and element wise
ones. We struggled for years how to do that in Python — until someone
realized that matrix multiplication is the only actually useful matrix
operation.

Hence @ and now we’re good.

-CHB

-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/XHRDRBAF4KAFV6AC267LQINQEFT7R45W/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to