Is there a way to parse expression with functions in them? #1739
Unanswered
magdalini-anastasiadou
asked this question in
Q&A
Replies: 1 comment
-
Pint only parses unary and binary operators, and a few selected things (squared, cubed) through replacements. It allows you to write a custom replacement rule should you like to write a textual transformation every single time. Regarding keyword arguments, pint does not support that. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I was wondering if there is a way to parse expressions with functions using parse_expression.
Here is a sample code explaining what I mean.
Initially, I thought that since we can pass keyworded arguments in parse_expression it would work with methods too, but this isn't the case. So I am searching for a different way.
Btw with keyworded arguments I mean this
parsed = ureg.parse_expression("x+2", x=2)
Also, I see there is a way to define methods using wrapping but pint isn't aware of the defined ones when it parses the expression.
So in conclusion, is there a way to do it?
Thanks :)
Beta Was this translation helpful? Give feedback.
All reactions