A REALLY COOL PYTHON FEATURE:
Robert Citek
rwcitek at uci.edu
Tue May 16 15:08:41 EDT 2000
At 12:13 PM 5/16/00 -0400, François Pinard wrote:
>Robert Citek <rwcitek at uci.edu> writes:
>
>> The join method is fine for converting lists to strings, but doesn't work
>> for converting lists to tuples. However, lambda works nicely here:
>
>> reduce(lambda x, y: x + (y,), somenames, ())
>
>Why not just tuple(somenames) ?
>
>--
>François Pinard http://www.iro.umontreal.ca/~pinard
Because it was late and my brain works in weird ways sometimes. Or maybe I
was just pleased with myself thinking that I could actually create
something with reduce and lambda and that it worked. :-)
Thanks for pointing out the obvious and helping me write better code.
- Robert
More information about the Python-list
mailing list