Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.0 eval() function in List Comprehension doesn't work #49494

Closed
JiafeiPeng mannequin opened this issue Feb 13, 2009 · 2 comments
Closed

Python 3.0 eval() function in List Comprehension doesn't work #49494

JiafeiPeng mannequin opened this issue Feb 13, 2009 · 2 comments

Comments

@JiafeiPeng
Copy link
Mannequin

JiafeiPeng mannequin commented Feb 13, 2009

BPO 5244
Nosy @birkenfeld
Superseder
  • bpo-5242: eval() function in List Comprehension doesn't work
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2009-02-13.10:42:06.039>
    created_at = <Date 2009-02-13.10:23:28.904>
    labels = []
    title = "Python 3.0 eval() function in List Comprehension doesn't work"
    updated_at = <Date 2009-02-13.10:42:06.037>
    user = 'https://bugs.python.org/JiafeiPeng'

    bugs.python.org fields:

    activity = <Date 2009-02-13.10:42:06.037>
    actor = 'georg.brandl'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-02-13.10:42:06.039>
    closer = 'georg.brandl'
    components = []
    creation = <Date 2009-02-13.10:23:28.904>
    creator = 'JiafeiPeng'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 5244
    keywords = []
    message_count = 2.0
    messages = ['81899', '81900']
    nosy_count = 2.0
    nosy_names = ['georg.brandl', 'JiafeiPeng']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '5242'
    type = None
    url = 'https://bugs.python.org/issue5244'
    versions = []

    @JiafeiPeng
    Copy link
    Mannequin Author

    JiafeiPeng mannequin commented Feb 13, 2009

    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
    [bpo-5242] 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?

    @birkenfeld
    Copy link
    Member

    Please don't open duplicates.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant