jeudi 23 octobre 2014

Issue with Python class that has a list


Vote count:

0




I have a simple question: Say that I have the following class:



class step:
alpha = []


and my main has the following:



listofstep = []

for i in range(20):
z = step()
z.alpha.append(0)
listofstep.append[z]


why does len(listofstep[0].alpha) gives me 20?



asked 1 min ago







Issue with Python class that has a list

Aucun commentaire:

Enregistrer un commentaire