Nested List Question
chris.mccoy at spirentcom.com
Thu Nov 3 06:33:40 CET 2005
Thank you! I've been banging my head against the wall!
"Alex Martelli" <aleax at mail.comcast.net> wrote in message
news:1h5f4t2.1yv785h120xalfN%aleax at mail.comcast.net...
> 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) ]
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
More information about the Python-list