Re: Q:Pythonic way to create list of lists

2009-04-12 Thread Tino Wildenhain
grkunt...@gmail.com wrote: I am just learning Python. I am trying to create a list of empty lists: [[], [], [], ...] (10 items total). Apart from the solutions shown, why would you do that in the first place? Creating such a structure is probably not so pythonic so the way to create it does n

Re: Q:Pythonic way to create list of lists

2009-04-12 Thread Arnaud Delobelle
grkunt...@gmail.com writes: > I am just learning Python. > > I am trying to create a list of empty lists: [[], [], [], ...] (10 > items total). > > What is the most Pythonic way to do this? > > If I use a list comprehension (as in myList = [[] for item in xrange > (0, 10)]), Netbeans warns me that

Re: Q:Pythonic way to create list of lists

2009-04-11 Thread Terry Reedy
grkunt...@gmail.com wrote: I am just learning Python. I am trying to create a list of empty lists: [[], [], [], ...] (10 items total). What is the most Pythonic way to do this? If I use a list comprehension (as in myList = [[] for item in xrange (0, 10)]), Netbeans warns me that 'item' is neve

Re: Q:Pythonic way to create list of lists

2009-04-11 Thread Tim Chase
I am trying to create a list of empty lists: [[], [], [], ...] (10 items total). What is the most Pythonic way to do this? If I use a list comprehension (as in myList = [[] for item in xrange (0, 10)]), Netbeans warns me that 'item' is never used. Not using Netbeans, I can't verify that the be

Q:Pythonic way to create list of lists

2009-04-11 Thread grkuntzmd
I am just learning Python. I am trying to create a list of empty lists: [[], [], [], ...] (10 items total). What is the most Pythonic way to do this? If I use a list comprehension (as in myList = [[] for item in xrange (0, 10)]), Netbeans warns me that 'item' is never used. If I use a for-loop