Simple list.append() question

Greg Ewing greg at cosc.canterbury.ac.nz
Thu Apr 27 21:18:36 EDT 2000


Bernhard Herzog wrote:
> 
> It would be a good idea IMO to find a
> good syntax for this case and ISTM that list comprehensions might be
> useful here:
> 
>   multi_list = [[] for i in range(10)]
> 
> or whatever the precise syntax was. Hmm, the unused variable in there is
> a bit ugly though.

Maybe the LC syntax should include something like

   [[] times 10]

-- 
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-list mailing list