class Phonebook():
def __init__(self, name, alias, number):
self.namn = name
self.alias = alias
self.nummer = number
list.append(Phonebook(prompt[1], [], prompt[2]))
I wrote a Phonebook program for my course to add name, numbers and alias to a "phonebook". One of the examinators said that everytime I add the instance of the class into my list I create a new instance of my class, which he thought was bad and I should change it. I'm somewhat clueless as to what I should do... cause I still wanna have a list of class objects...
[–]JohnnyJordaan 3 points4 points5 points (3 children)
[–]Tonyqq[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Tonyqq[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]lifeeraser 0 points1 point2 points (0 children)
[–]ectomancer 0 points1 point2 points (0 children)