A REALLY COOL PYTHON FEATURE:

Courageous jkraska1 at san.rr.com
Thu May 11 07:02:46 CEST 2000


While all the oldtimers here already know this, I thought
I might share something really cool with some of my newbie
peers.... :)

>>> 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? It's a godawful pain
in the ass, let me tell you. And there it is, in all it's
glory:

reduce ( lambda x, y: x+", "+y, somenames )

Gawd. Beautiful.





C/



More information about the Python-list mailing list