[New-bugs-announce] [issue5244] Python 3.0 eval() function in List Comprehension doesn't work

Jiafei Peng report at bugs.python.org
Fri Feb 13 11:23:29 CET 2009


New submission from Jiafei Peng <jiafei.peng at iav.de>:

Jiafei Peng <jiafei.peng at iav.de> added the comment:

Yes
it does work properly outside listcomps.

            canBusType = 'CANdiag'
            result1 = eval('canBusType')
            result2 = [eval('canBusType'), eval('canBusType'), eval(
'canBusType')]
            result3 = [eval('canBusType') for i in range(3)]

result1 = 'CANdiag'
result2 =['CANdiag' 'CANdiag' 'CANdiag']
for result3:
NameError: name 'canBusType' is not defined

Best regards, mit freundlichen Grüßen,
Jiafei Peng
IAV GmbH
Nordhoffstr. 5
38518 Gifhorn
GERMANY
Phone: +49 5371  805-2817
Fax:+49 5371  805-1330

Ezio Melotti <report at bugs.python.org> 
13.02.2009 11:04
Bitte antworten an
Python tracker <report at bugs.python.org>

An
jiafei.peng at iav.de
Kopie

Thema
[issue5242] eval() function in List Comprehension doesn't work 

Ezio Melotti <ezio.melotti at gmail.com> added the comment:

I can't reproduce it either, tested with Py3 (on Linux and Windows) and
with Py2.[456], it worked fine everywhere.

Does your eval() work properly outside listcomps?

----------
messages: 81899
nosy: JiafeiPeng
severity: normal
status: open
title: Python 3.0 eval() function in List Comprehension doesn't work

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5244>
_______________________________________


More information about the New-bugs-announce mailing list