gah! I hate the new string syntax

Sean 'Shaleh' Perry shaleh at
Fri Mar 2 17:40:07 CET 2001

On 02-Mar-2001 Tim Roberts wrote:
> "Sean 'Shaleh' Perry" <shaleh at> wrote:
>>return ";".join(["%s=%s" % (k, params[k]) for k in params.keys()])
>>every day python seems to be moving closer to the line noise aspect of
> But join is really the only one of the string methods that comes out so
> awkwardly.  The rest of them are quite sensible.  And, at least for now,
> you do still have the traditional string.join alternative.
> Wouldn't your code be slightly quicker if you used items() instead of
> looking up the individual keys:
> return ";".join(["%s=%s" % it for it in params.items()])

That snippet came from 'Dive into Python' a book for python programmers.  The
style of code in there is not anything I would want a fellow coder to follow.

The point of all of this was 'join' especially, but a few of the others (it
brother split) make for really ugly code.

" ".split(list) is another I have seen recently.

More information about the Python-list mailing list