I am defining some lists as static (class) variables, and using a nested definition fails with NameError
on the inner variable:
class A(object):
a = [1, 2, 5]
b = [6, 7, 8]
c = [(x, 2*x) for x in a] #--- OK
d = [(x, 2*x) for x in b] #--- OK
e = [(x, 2*y) for x in a for y in b] #--- Fails with "NameError"
How come the last line fails, while the line before last does not?
I am using Python 3.7.4.