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
Hello,
Consider :
li = [1,2,3]
repr(li)
'[1, 2, 3]'
Is there a standard way to get back li, from repr(li) ?
Regards,
Harish
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Dec 31, 2008 at 2:46 PM, Harish Vishwanath
harish.shas...@gmail.com wrote:
Hello,
Consider :
li = [1,2,3]
repr(li)
'[1, 2, 3]'
Is there a standard way to get back li, from repr(li) ?
Normally you would use eval(..) however this is
considered by many to be evil and bad practise
En Wed, 31 Dec 2008 02:46:33 -0200, Harish Vishwanath
harish.shas...@gmail.com escribió:
li = [1,2,3]
repr(li)
'[1, 2, 3]'
Is there a standard way to get back li, from repr(li) ?
py eval('[1, 2, 3]')
[1, 2, 3]
eval is like Pandora´s box, all kind of bad things can come from it. Do
not
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