[EMAIL PROTECTED] wrote:
> Hallo,
> 
> I'm after
> 
> [[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]]]
> 
> (NxN 'grid', 5x5 in that example, and while typing this up i figured out
> how to get it, but I'm still not sure what _was_ happening)
> 
> 
> I'm trying
> 
>>>>> a=[]
>>>> row=[ [] for n in range(0,10) ]
>>>> a.extend(row[:])
>>>> a
> [[], [], [], [], [], [], [], [], [], []]
>>>> a[0].extend(row[:])
>>>> a
> [[[...], [], [], [], [], [], [], [], [], []], [], [], [], [], [], [], [],
> [], []]
> 
> 
> why isnt that last a
> 
> [[[...]],[],[],[],[],[],[],[],[],[]]
> 
> 
> Puzzled :)
> 
> Matt.
> --
........

To get an n by m grid I would use

[[[] for i in xrange(m)] for j in xrange(n)]


-- 
Robin Becker

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to