Could you help me to find the problems?
I just add the object to one list, but it seems that it appears in another list!
class people(object):
name = ""
__adjacent = []
position = 0
def __init__(self,nam):
self.name = nam
def print_name(self):
print self.name
def get_adjacent(self):
return self.__adjacent
def append_adjacent(self,people):
self.__adjacent.append(people)
sis = people('sister')
bro = people('brother')
sis.append_adjacent(bro)
print len(bro.get_adjacent())
for i in bro.get_adjacent():
i.print_name()
print len(sis.get_adjacent())
Question: why there is a object in bro's adjacent list???