On Sun, 27 Jul 2008 09:28:28 -0700, Gary Herron <[EMAIL PROTECTED]>
wrote:


>>     a = list(set(itertools.chain(*sessexam.values())))
>>     a.sort() #As I write I'm wondering if I really need it sorted. Hmm...
>>     return a

>Didn't someone already answer that.  List addition and sum() both do 
>what you want.
>
> >>> A = [1,2,3]
> >>> B = [4,5,6]
> >>> C = [7,8,9]
>
> >>> A+B+C
>[1, 2, 3, 4, 5, 6, 7, 8, 9]

True, although unsuitable for my circumstance.


> >>> sum([A,B,C], [])
>[1, 2, 3, 4, 5, 6, 7, 8, 9]

Ah. I had no luck with sum, but I hadn't realised it needed the "[]" term. I
must read about it again.

>It doesn't get any easier than that.

Not only that, but it's exactly what I was after - and fastest, too,
although speed isn't really an issue. Thank you.

DaveM
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to