Nested List Question
Alex Martelli
aleax at mail.comcast.net
Thu Nov 3 00:26:37 EST 2005
More information about the Python-list mailing list
Thu Nov 3 00:26:37 EST 2005
- Previous message (by thread): Python for .NET and IronPython
- Next message (by thread): Nested List Question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Newsfeeds <chris.mccoy at spirentcom.com> wrote: > Hello All, > > Could anyone tell me why this code produces the output it does? ... > gridSystemId = [[None]*columns]*rows You've made gridSystemID a list of `rows` references to the SAME "inner" list, so the behavior you observe is the only possible one. If you want copies instead, ASK for copies...: gridSystemId = [ [None]*columns for x in xrange(rows) ] Alex
- Previous message (by thread): Python for .NET and IronPython
- Next message (by thread): Nested List Question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list