7 ms·
It seems like I can boil down the rationale as: 1. Numpy people overload * for element-wise mul and matmul inconsistently and confusing people 2. The prefix fu
by wyuenho 13y ago
It seems like I can boil down the rationale as:
1. Numpy people overload * for element-wise mul and matmul inconsistently and confusing people
2. The prefix func calls convention for matmul makes the formulas difficult to read
3. Python's precedence for splitting / into / and // can't apply to matmul because * * is already taken.
4. ` is banned, ?! lend unrelated meanings to context, $ is Perl and PHP baggage, so @ is the only thing left?
I got lost on the choice for @. If ?! lends unrelated meaings, and $ is Perlism, why doesn't @ suggest some kind of concat ops or Bashish/Perlish array sigils?
I'd personally much prefer >< . It looks like x, so it's much clearer. I don't understand the PEP's reason for not using ><.
- kzrdude 13y agoYes `backticks` are banned since Python 3 because 1) They are hard to type many on common keyboard layouts 2) They are hard to read, especially in Python books.
- Dorian-Marie 13y agoI use backticks a lot when writing Markdown and Ruby code and it's easy to type (on a Mac keyboard at least) and is as easy to print as any other character.
- kzrdude 13y agoMac keyboard layout varies by both country and language though.
- tomp 13y agoI don't understand the hate for backticks either. I used to dislike them too, when I was just a hobby programmer, and used a Slovenian keyboard layout (even for programming). Needless to say, after switching to English layout, my programming skills quadrupled - ` isn't the only symbol barely accessible (without finger acrobatics) on international keyboards (other examples include: {}][|~\^ ).
- kzrdude 13y agoI've stuck to Swedish layout but I've remapped all of `{}[]()\ in fact! :-)
- ak217 13y agoI don't get why they don't just let * do matrix multiplication on matrices, and introduce .* for element-wise multiplication.
- dagw 13y agoBecause * has been element-wise multiplication in python numeric/numpy since the python 1.0 days. Introducing such a massive and fundamental backwards incompatible syntax change just as python 3 is starting to settle down and slowly gaining acceptance is probably not a good idea
- ak217 13y agoGreat point, I forgot about that. In that case, I wish they'd used * * * or something. @ just doesn't seem right to me.
- pekk 13y agoThis is a problem for python numeric/numpy, not Python. Let them fix their own problems
- dragonwriter 13y agoThe change being made to python exists to enable the fix preferred by much of the community to the API fragmentation problem that exists among python numeric libraries given the need for both convenient matrix multiplicationa and convenient elementwise multiplication. Since its a fairly dominant application area that is pretty key for Python (there's a reason there are so many bundled python distributions that include the common scientific/numeric libraries, and that those environments are often chosen as pedagogical tools even for general-purpose programming), making a fairly modest language-level change to enable a clean resolution to this fragmentation is a sensible thing to do.
- sieisteinmodel 13y agoAlso, A x B is not used for dot product in the math world. That is mostly cross product, and might trigger wrong associations.