Re: Sequence of empty lists

2005-02-22 Thread Paul Rubin
[EMAIL PROTECTED] (JP. Baker) writes: > How *should* I create a sequence of N empty lists (buckets)? a = [[] for i in xrange(N)] -- http://mail.python.org/mailman/listinfo/python-list

Re: Sequence of empty lists

2005-02-22 Thread Peter Hansen
Diez B. Roggisch wrote: seq = [[] for i in xrange(10)] And the reason you need that approach is given in the FAQ: http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list It's a very good idea to read the entire FAQ as soon as you've gotten past the very basic Python l

Re: Sequence of empty lists

2005-02-22 Thread Diez B. Roggisch
seq = [[] for i in xrange(10)] -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Sequence of empty lists

2005-02-22 Thread JP. Baker
I give up (and have prepared myself for replies telling me which search strings to use on Google etc)! How *should* I create a sequence of N empty lists (buckets)? I obviously can't use a = [[]]*N and I have found various solutions and am currently using a = map(lambda x: [], range(N)) but ca