[Python-ideas] List Revolution

Devin Jeanpierre jeanpierreda at gmail.com
Sat Sep 10 19:43:53 CEST 2011


> Damn dollar signs.
> if not re.compile('^[\d\+\*\(\)]+$').match(name): return AttributeError

'(2**1024)**(2**1024)' etc.

Devin

On Sat, Sep 10, 2011 at 1:05 PM, Massimo Di Pierro
<massimo.dipierro at gmail.com> wrote:
> LOL.
>
> Damn dollar signs.
> if not re.compile('^[\d\+\*\(\)]+$').match(name): return AttributeError
>
> On Sep 10, 2011, at 11:45 AM, Stefan Behnel wrote:
>
>> 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
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> http://mail.python.org/mailman/listinfo/python-ideas
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



More information about the Python-ideas mailing list