I am building my class and starting by defining 3 class attributes like this:
> class Test:
first_list= [1,2,3,4,5]
second_list = [1,2]
third_list = [
ex for ex in first_list if ex not in second_list
]
I am using the class variable 'first_list' and the class variable second_list to define a new class variable 'third_list' in a list comprehension
I get a NameError name 'second_list' is not defined
Cant understand why
If I define my third_list as :
third_list = first_list + second_list
all works fine
it seems I cannot use 2 class variables inside a comprehension ! but one only works:
third_list = [ex for ex in first_list if ex not in [1,2]]