I think that's exactly the problem with a lack of Python macros. The full 
quote, of course, goes: "There should be one-- and preferably only one 
--*obvious* way to do it."

Often, there's a mathematical notation for something, and *this* is the only 
obvious way to write anything out. But this doesn't work if you force every 
package to adopt the same syntax. For example, if you'd like a package to work 
with probabilities, it's very reasonable to want to write `x ~ Normal(0, 1)` to 
say x follows a normal distribution. This is the only syntax I consider natural 
for this problem; but packages can't do that, since `~` already has a meaning 
outside of probability.

Not to mention, DSLs are forced to adopt all kinds of weird syntax when the 
behavior of base Python doesn't align with what the DSL needs to do. Obviously, 
the only way to write out a `for` loop should be to use the `for` keyword. This 
doesn't work in JAX. If you want to use a `for` loop in JAX, you have to use 
the `lax.fori_loop` function, or else `for` will end up being unrolled, because 
of various requirements of the JAX compiler. Having to use `lax.fori_loop` is, 
to put it mildly, *incredibly* unpythonic.

This really is the biggest reason I switched to Julia: Python math is 
unpythonic. I don't want to be forced to learn lots of weird little functions 
like `np.matmul(x1, x2)` when there's already one obvious syntax I'm very 
familiar with: `x1 *  x2`.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/6QM4GMH5FDX2H5OZHCE33EOJHCV3TI2R/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to