complex data types?

rixil at hotmail.com rixil at hotmail.com
Sun Sep 18 00:51:13 EDT 2005


That is a great example Gustavo...

One way that Richard's error of array[0] equaling array[1] could be
introduced would be by accidentally appending the 'music' class object
onto his list, rather than creating a new instance of music each time.
Changing the code:

array.append(music())
array.append(music())

to:

array.append(music)
array.append(music)

would produce the symptom described by Richard, as both array[0] and
array[1] would be references for the music class object.

ML




More information about the Python-list mailing list