class A(object):
test = 'test'
d = ['a', 'b']
[i + test for i in d]
In python2.7, this code works, in python3.6, will report NameError: name 'test' is not defined
.
I assume it's related to class attribute working scope change , but haven't found anythings in doc.