Re: trouble with lists

2005-05-03 Thread Kristian Zoerhoff
On 5/3/05, Anand Kumar <[EMAIL PROTECTED]> wrote: > > I am actually trying to mimic a multi dimensional array in C. > I tried doing things like Python lists are not arrays in that sense. If you really want an array, you probably want Numeric or Numarray. Head over to http://numeric.scipy.org/ to

Re: trouble with lists

2005-05-03 Thread Bill Mill
On 3 May 2005 10:42:43 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm new to python. I tried doing this > > >>> x = [[]] * 3 > >>> print x > [ [] [] [] ] > >>> x[0].append( 2 ) > [ [2] [2] [2] ] > > I confused with the last line output. I actually expected something > like > > [ [2] [

Re: trouble with lists

2005-05-03 Thread vincent wehren
<[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] | I'm new to python. I tried doing this | | >>> x = [[]] * 3 | >>> print x | [ [] [] [] ] | >>> x[0].append( 2 ) | [ [2] [2] [2] ] | | I confused with the last line output. I actually expected something | like | | [ [2] [] [] ] | |

Re: trouble with lists

2005-05-03 Thread Kristian Zoerhoff
On 3 May 2005 10:42:43 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm new to python. I tried doing this > > >>> x = [[]] * 3 > >>> print x > [ [] [] [] ] > >>> x[0].append( 2 ) > [ [2] [2] [2] ] > > I confused with the last line output. I actually expected something > like > > [ [2] [

trouble with lists

2005-05-03 Thread anandr86
I'm new to python. I tried doing this >>> x = [[]] * 3 >>> print x [ [] [] [] ] >>> x[0].append( 2 ) [ [2] [2] [2] ] I confused with the last line output. I actually expected something like [ [2] [] [] ] Can anyone give me an explanation. help!! -- http://mail.python.org/mailman/listinfo/pyth