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 can't help feeling that I have missed something obvious.

nhoJ
-- 
John P Baker
-- 
http://mail.python.org/mailman/listinfo/python-list


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


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