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

Jiafei Peng report at bugs.python.org
Fri Feb 13 10:42:05 CET 2009


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

eval() function in List Comprehension doesn't work.
please see the under codes:

canBusType = 'CANdiag'
result = [eval('canBusType') for i in range(3)]
NameError: name 'canBusType' is not defined

It did work in Python2.5 or 2.6. The expected result is 
['CANdiag', 'CANdiag', 'CANdiag'].

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

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


More information about the New-bugs-announce mailing list