On 19 Nov 2005 07:06:30 -0800, [EMAIL PROTECTED] wrote: >I've seen this construct in a script > >>>> [x.capitalize() for x in ['a','b', 'c']] >['A', 'B', 'C'] > >I tried another myself > >>>> [x+1 for x in [1,2,3]] >[2, 3, 4] >>>> > >Apparently you can do >[function(x) for x in list] > >I tried to find a description of this in "Library Reference" but >couldn't find it. Could somebody direct me where this type of construct >is described. > It's called a list comprehension. You can find that term in various indices of the various docs. In a minute I found these. I'm sure there's more if you google.
http://docs.python.org/ http://docs.python.org/tut/node18.html#l2h-61 http://docs.python.org/ref/lists.html#l2h-345 Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list