> If I could go back to 1995 or thereabouts when Python was first
> starting, I would make a clear distinction between scalar and vector
> operations, like Julia does.
>
> Borrowing Julia's syntax:
>
>     a == b   # compare a to b, returns True or False
>     a .== b  # elementwise comparison
>
>     a*b   # multiply a by b
>     a.*b  # elementwise multiplication


That was borrowed from MATLAB, and as a former MATLAB user, I can tell you
it sucks ;-).

In the Python world, it would mean double as many operators, and that was
discussed for years, until it was realized that the only truly useful new
operation was matrix multiplication — and thus @ was introduced.

So in this case, maybe there is another use case: elementwise vs
vector-wise bool().

But I don’t think it’s important— numpy arrays are different enough from
other sequences that you really need to know which you have anyway.

In fact, having bool() raise on numpy arrays means code that isn’t
expecting them will fail early, which is a good thing.

We need to remember that PEP-8 is a set of recommendations that do not
apply to all cases. Making numpy arrays able to conform to PEP-8 is a
non-goal.

-CHB


-- 
Christopher Barker, PhD

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/XSLZFK3DDF4ZA36SEUZVEXBNYI42WFXS/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to