New submission from yesheng <13611358...@139.com>:

def yyy():
    a, b = 'abc', 'abd'
    print([eval(i) for i in ('a', 'b')])


def zzz():
    a, b = 'abc', 'abd'
    print({i: eval(i) for i in ('a', 'b')})


yyy()  # ok
zzz()  # NameError: name 'a' is not defined, however in yyy() it is ok

----------
messages: 330073
nosy: yesheng
priority: normal
severity: normal
status: open
title: 'eval' in generator expression behave different in dict from list
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35273>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to