21 ms·
In the article he describes using this for user-provided mathematical expressions. I suppose that makes sense if you're implementing a light DSL in python... B
by Pxtl 3y ago
In the article he describes using this for user-provided mathematical expressions. I suppose that makes sense if you're implementing a light DSL in python... But maybe don't?
Edit: I don't believe this is any slower, actually. It may even be marginally faster than a class, since a class adds some QOL features that will add a little overhead that would add a few branches to the code path.
But if you're worried about speed, don't use Python anyways.