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

Jiafei Peng report at bugs.python.org
Fri Feb 13 11:14:39 CET 2009


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

Softwareentwickler / Embedded System Software (EF-F2)
Software developer / Embedded System Software 

IAV GmbH
Nordhoffstr. 5
38518 Gifhorn
GERMANY

Phone: +49 5371  805-2817
Fax:+49 5371  805-1330

E-mail:  <mailto:Jiafei.Peng at iav.de>
Internet: http://www.iav.de

IAV GmbH
Sitz/Registered Office: Berlin
Registergericht/Registration Court: Amtsgericht Charlottenburg
Registernummer/Company Registration Number: HRB 21 280
Geschäftsführer/Managing Directors: Kurt Blumenröder, Michael Schubert

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?

----------
nosy: +ezio.melotti

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

Added file: http://bugs.python.org/file13066/unnamed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5242>
_______________________________________
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: unnamed
URL: <http://mail.python.org/pipermail/python-bugs-list/attachments/20090213/f2287641/attachment.txt>


More information about the Python-bugs-list mailing list