En Wed, 31 Dec 2008 04:27:01 -0200, Steven D'Aprano <st...@remove-this-cybersource.com.au> escribió:

On Wed, 31 Dec 2008 03:08:29 -0200, Gabriel Genellina wrote:

eval is like Pandora´s box, all kind of bad things can come from it. Do
not use it with any user-supplied string. If you can restrict the values
to be just constants, there is a "safe eval" recipe in
http://code.activestate.com

The ast module in Python 2.6 includes a "literal eval" function:

ast.literal_eval("[1, 2, 3]")
[1, 2, 3]

That's a very nice addition!

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to