Disclaimer: New to stack overflow. In the Julia language the eval(parse())
ability comes in very useful. Example: eval(parse("x = 5"))
. I'm wondering if there is an equivalent in python, I get the consensus that this is a no. If it is a no why? Surely it would be a useful addition to the language.
Asked
Active
Viewed 31 times
0

Thomas Leyshon
- 87
- 4
-
1I'm not sure why this was closed; it seems like it could be a useful discussion? I was about to post this before it was closed: --------------------- In python, this is just `eval("expression")`: https://www.programiz.com/python-programming/methods/built-in/eval The difference is that Python does not (as far as I know) have a built-in, first-class structure for representing _parsed expressions_, which julia of course makes heavy use of for metaprogramming. --------------- EDIT: Ah i see now it was closed as a duplicate. I guess that makes sense. StackOverflow is strict! :) – NHDaly Jan 20 '21 at 13:55
-
Welcome to StackOverflow :) – NHDaly Jan 20 '21 at 13:57