#--------------------------------------------------------------------------------------------------------------------------- class signal: lst = [] booklist = None data = [[0, 'nickname' , "nickname"], [1, 'name' , "notempty"]] def __init__(self, row, nrow): for key in self.data: if check(row[key[0]], key[2], "Лист: " + self.booklist + " Строка: " + str(nrow)): setattr(self, key[1], row[key[0]]) @staticmethod def exist(nickname): result = False for i in lst: result = result or i.nickname == nickname return result #--------------------------------------------------------------------------------------------------------------------------- class di(signal): booklist = "DI" data = [[0, 'nickname' , "nickname"], [1, 'in' , "in" ], [2, 'category' , "int" ], [3, 'log' , "bool" ], [4, 'name' , "notempty"], [5, 'inversion', "bool" ], [6, 'ton' , "time" ], [7, 'tof' , "time" ], [8, 'module' , "notempty"], [9, 'cleath' , "notempty"], [10, 'device' , "notempty"]] In the body of the program do:
print(di.exist("P_cool_pg1_high")) I get the error: Traceback (most recent call last): File "C: \ Users \ and-work \ Desktop \ Bear SP \ python \ autogen_owen_1.py", line 197, in print (di.exist ("P_cool_pg1_high"))) File "C: \ Users \ and-work \ Desktop \ Bear SP \ python \ autogen_owen_1.py", line 117, in lst: NameError: name 'lst' is not defined
How to turn to lst? lst is by the way a list of signal class instances.