I want to operate a local list in a class in Python. I can not do that:
class cCompetition:
lcPersonAll = []
def AddPerson(self, cPersonNew):
lcPersonAll.append(cPersonNew)
cCompetition1 = cCompetition()
cCompetition1.AddPerson("Smith")
However, global list is possible.
Comments
Let us see what you have tried and the error you are getting
You can subclass list like this
Notice there is no need for init unless you wish to do something extra there.
You don't need to append a list and then turn it into a tuple, you can create the tuple directly with () instead of []
Learn Python https://hackr.io/tutorials/learn-python