[Python-ideas] List Revolution
Massimo Di Pierro
massimo.dipierro at gmail.com
Sat Sep 10 19:48:46 CEST 2011
remember name is an attribute. It cannot contain special symbols (*) by definition. There is no way you can build "**".
On Sep 10, 2011, at 12:43 PM, Devin Jeanpierre wrote:
>> 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