This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python 3.0 eval() function in List Comprehension doesn't work
Type: Stage:
Components: Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: eval() function in List Comprehension doesn't work
View: 5242
Assigned To: Nosy List: JiafeiPeng, georg.brandl
Priority: normal Keywords:

Created on 2009-02-13 10:23 by JiafeiPeng, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg81899 - (view) Author: Jiafei Peng (JiafeiPeng) Date: 2009-02-13 10:23
Jiafei Peng <jiafei.peng@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@bugs.python.org> 
13.02.2009 11:04
Bitte antworten an
Python tracker <report@bugs.python.org>

An
jiafei.peng@iav.de
Kopie

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

Ezio Melotti <ezio.melotti@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?
msg81900 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-02-13 10:42
Please don't open duplicates.
History
Date User Action Args
2022-04-11 14:56:45adminsetgithub: 49494
2009-02-13 10:42:06georg.brandlsetstatus: open -> closed
resolution: duplicate
superseder: eval() function in List Comprehension doesn't work
messages: + msg81900
nosy: + georg.brandl
2009-02-13 10:23:28JiafeiPengcreate