I am working with a set of strings that could contain math operators, either '+' or '-' for now. Initially i used eval which was pretty straightforward. I am trying to move away from eval due to its known issues but mostly am trying to improve the speed. Here is a typical set of string that i would work on :
DAC = ('12','0x1E','34','12+20','2+0x1F')
Taking each value and applying the eval will give the results i need. To move away from this I tried a few methods, they work fine until i hit into a math operator. I did read about AST module and am gonna work on that but would like to get some feedback if its the right track to go in terms of improving the speed or any other suggestions the community can give me..
Thanks