On Thu, Jan 1, 2009 at 10:13 AM,  <davida...@gmail.com> wrote:
> Consider these two lists comprehensions:
>
> L1=[[1 for j in range(3)] for i in range(3)]
> L2=[[1]*3]*3
<snip>
> So far, everything is OK, but let us now modify the lists' contents in
> the following way:
<snip>
> It seems a misbehaviour in Python, or there is something I do not
> understand in the syntax ????

The latter, and it's a FAQ. Please read
http://www.python.org/doc/faq/programming/#how-do-i-create-a-multidimensional-list
(it's question 4.6).

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to