A REALLY COOL PYTHON FEATURE:

Andrew Dalke dalke at acm.org
Thu May 11 07:20:30 CEST 2000


Courageous wrote:
>>>> somenames = ["fred", "barney", "wilma", "betty"]
>>>> reallycool = reduce ( lambda x, y: x+", "+y, somenames )
>>>> reallycool
>'fred, barney, wilma, betty'
>>>>
>
>Check that out. Do you know what a royal pain in the ass
>it is in most languages to do this?

BTW, the usual way to do that is

  string.join(somenames, ", ")

                    Andrew
                    dalke at acm.org






More information about the Python-list mailing list