Enable support for compound types and comprehensions
mainBy default, SimpleEval supports compound types (dict, tuple, list, set) if they are passed in via names.
To allow the creation of these types within expressions (e.g., using list comprehensions like [x + 1 for x in [1,2,3]]), use the EvalWithCompoundTypes class instead of SimpleEval. This class includes a safety mechanism MAX_COMPREHENSION_LENGTH to prevent resource exhaustion from deeply nested or overly large comprehensions.
from simpleeval import EvalWithCompoundTypes
s = EvalWithCompoundTypes()
s.eval("[x + 1 for x in [1, 2, 3]]")