4 ms·
The author has made DSL in Python by (ab?)using context managers and the bitshift operator. It's very interesting, and I haven't seen anything quite like it. P
by heisenzombie 6y ago
The author has made DSL in Python by (ab?)using context managers and the bitshift operator. It's very interesting, and I haven't seen anything quite like it.
Python can lend itself to horrific abuses through shenanigans like this. I sometimes feel that siren call myself, and usually regret it.
So by default I'm pretty skeptical of this kind of thing, but I'm actually on the fence about this one.
- whatshisface 6y agoCheck out Sagemath for an entire Mathematica thing done entirely through overloading.
- heisenzombie 6y agoYes! A good point of comparison. (n.b. I have only used SymPy, not Sagemath. I'm assuming they're similar) I think sympy (and maybe sage) is a bit different because they're (mostly?) overloading operators for their intended purpose -- that is, the "+" operator does semantically add python objects that represent symbolic math.
- whatshisface 6y agoSagemath is a big package that includes sympy.