It's very hard to make Python's eval safe. It's much easier to use something like PyParsing or PLY to parse the string yourself, and in doing that add the extra precautions you need, like checking for too large results before actually doing the computation.
If you can trust your users then don't worry about it.
Comment
What is 9**9**9**9**9**9**9**9?
It's very hard to make Python's eval safe. It's much easier to use something like PyParsing or PLY to parse the string yourself, and in doing that add the extra precautions you need, like checking for too large results before actually doing the computation.
If you can trust your users then don't worry about it.
Parent comment
I could do a regex on something like '\d{6,99}' to filter out too big numbers.