> Python has consistently refused to be turned into a platform for DSLs for
> almost 3 decades.
I think SymPy, PyMC, Pyomo, Pyro, and many more packages would all be very
surprised to hear they're no longer welcome in Python. Still, it seems like it
would be quite hard to kick them out, and would probably make the scientific
programming community pretty angry. If you don't like having DSLs in Python, I
think you're trying to close the barn door after the horse has bolted; you'd
have to go back in time to the creation of NumPy.
Syntactic macros aren't necessary for DSLs; it just makes them better. Without
syntactic macros, DSLs are forced to use clunky, complicated, and error-prone
string manipulation, rather than cleaner syntactic transformations. For
instance, here's NumPy's einsum, effectively behaving like a string macro:
```
X = np.einsum('ij,jk->ik', A, B, optimize='optimal')
```
And now here's the same thing in Julia:
```
@einsum X[i, k] := A[i, j] * B[j, k]
```
Which is more readable? Which is more Pythonic?
It's not that Python doesn't have DSLs (NumPy is effectively a DSL for linear
algebra). It's just that their syntax is sufficiently obscure that it's not at
all clear that's what they're doing.
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/RWSSY4KZLQYXHFF34AR544C44NZ6K7XE/
Code of Conduct: http://python.org/psf/codeofconduct/