[issue36070] Enclosing scope not visible from within list comprehension

2019-02-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is a duplicate of issue3692. -- nosy: +serhiy.storchaka resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> improper scope in list comprehension, when used in class declaration _

[issue36070] Enclosing scope not visible from within list comprehension

2019-02-21 Thread Eric V. Smith
Eric V. Smith added the comment: I suspect Nathan is seeing this problem at class scope. This is a well known issue: >>> class C: ... from random import random ... out = [random() for ind in range(3)] ... Traceback (most recent call last): File "", line 1, in File "", line 3, in C

[issue36070] Enclosing scope not visible from within list comprehension

2019-02-21 Thread Zachary Ware
Zachary Ware added the comment: Can you attach a test file that shows the failure? -- nosy: +zach.ware ___ Python tracker ___ ___ P

[issue36070] Enclosing scope not visible from within list comprehension

2019-02-21 Thread Nathan Woods
New submission from Nathan Woods : The following code works in an interactive shell or in a batch file, but not when executed as part of a unittest suite or pdb: from random import random out = [random() for ind in range(3)] It can be made to work using pdb interact, but this doesn't help wit