How to concatenate list members

Christopher chris_mk at hotmail.com
Fri May 31 19:09:15 EDT 2002


Ah yes, I do agree wholeheartedly.  It was merely, as I said, the
idiom from the Eckel page.  On a more personal note, I use lambda
very, very rarely (I had problems with it when I was learning Python
and, while I've got it now, I'm still a bit gun-shy).  I think that
the whole idea was supposed to be a kind of mini-lesson in Python
(Eckel states that when you figure out why it works, you'll get a warm
feeling all over {so this is obviously for beginners}).  Thanks.

Chris

Peter Hansen <peter at engcorp.com> wrote in message news:<3CF6B54A.41E4E81B at engcorp.com>...
> Christopher wrote:  
> > ...http://www.mindview.net/Books/Python/ThinkingInPython.html...
> > has a section on the page called "An idiom
> > for concatenating strings" which looks like:
> > 
> > cs = lambda *args: ''.join(map(str,args)).
> 
> This would probably be more readable as:
> 
> def cs(*args):
>     return ''.join(map(str,args))
> 
> Changing the name from "cs" to "joinAsStrings" or something 
> would also improve the readability and maintainability.
> 
> -Peter



More information about the Python-list mailing list