REPOST: is this a bug or what?

Garth Kidd garth at netapp.com
Fri Jan 11 01:02:20 EST 2002


This isn't new age math, no. What you've got is an array containing three
references to the same array. :)

"I.J." <shiver at yubc.net> wrote in message
news:3$--$$_--__-$$_-%$@news.noc.cabal.int...
> >>> M=[[0]*3]*3
> >>> M
> [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
> >>> M[1][1]=1
> >>> M
> [[0, 1, 0], [0, 1, 0], [0, 1, 0]]
>
> Is this new age math?





More information about the Python-list mailing list