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.

Author JiafeiPeng
Recipients JiafeiPeng
Date 2009-02-13.09:42:04
SpamBayes Score 2.8267368e-05
Marked as misclassified No
Message-id <1234518125.96.0.444530348539.issue5242@psf.upfronthosting.co.za>
In-reply-to
Content
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'].
History
Date User Action Args
2009-02-13 09:42:06JiafeiPengsetrecipients: + JiafeiPeng
2009-02-13 09:42:05JiafeiPengsetmessageid: <1234518125.96.0.444530348539.issue5242@psf.upfronthosting.co.za>
2009-02-13 09:42:04JiafeiPenglinkissue5242 messages
2009-02-13 09:42:04JiafeiPengcreate