[Python-ideas] List Revolution

Stefan Behnel stefan_ml at behnel.de
Sat Sep 10 18:45:58 CEST 2011


Massimo Di Pierro, 10.09.2011 18:35:
> [...]
>          if not re.compile('[\d\+\*\(\)]+').match(name): return AttributeError
>[...]
> I would like to stress that the use of eval in this case is safe as the expression is first validated against a regex.

Nice try. And it would even be ok if you had assured that the *entire* 
expression was validated against the regex.

Stefan




More information about the Python-ideas mailing list