Re: Syntax Question - list multiplication

2007-08-19 Thread James Stroud
MC wrote: > Classic Thanks Michel, but maybe this bit of programming jargon needs some translation for the uninitiated: Classic \Clas"sic\ (kl[a^]s"s[i^]k), Classical \Clas"sic*al\, a. 0. Read the FAQ 1. First rate 2. Greek 3. Refined James -- James Stroud UCLA-DOE Institute for Genomics and

Re: Syntax Question - list multiplication

2007-08-19 Thread Duncan Smith
Roel Schroeven wrote: > Pablo Torres schreef: > >> Hi guys! >> >> I am working on Conway's Game of Life right now and I've run into a >> little problem. >> I represent dead cells with 0s and live ones with 1s. Check this out: >> >> >>> grid = [[0] * 3] * 3 >> >>> grid >> [[0, 0, 0], [0

Re: Syntax Question - list multiplication

2007-08-19 Thread Pablo Torres
Thanks everyone. Now I see why every row in my grid were actually the same object. Pablo -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax Question - list multiplication

2007-08-19 Thread Roel Schroeven
Pablo Torres schreef: > Hi guys! > > I am working on Conway's Game of Life right now and I've run into a > little problem. > I represent dead cells with 0s and live ones with 1s. Check this out: > > >>> grid = [[0] * 3] * 3 > >>> grid > [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >

Re: Syntax Question - list multiplication

2007-08-19 Thread Thomas Jollans
On Sunday 19 August 2007, Pablo Torres wrote: > Hi guys! > > I am working on Conway's Game of Life right now and I've run into a > little problem. > > I represent dead cells with 0s and live ones with 1s. Check this out: > >>> grid = [[0] * 3] * 3 > >>> grid > > [[0, 0, 0], [0, 0,

Re: Syntax Question - list multiplication

2007-08-19 Thread MC
Classic -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Syntax Question - list multiplication

2007-08-19 Thread Pablo Torres
Hi guys! I am working on Conway's Game of Life right now and I've run into a little problem. I represent dead cells with 0s and live ones with 1s. Check this out: >>> grid = [[0] * 3] * 3 >>> grid [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >>> grid[0][0] = 1 [[1, 0,