gah! I hate the new string syntax

Robin Becker robin at jessikat.fsnet.co.uk
Fri Mar 2 10:51:41 EST 2001


In article <0vpn79.331.ln at 127.0.0.1>, Carl Banks <idot at vt.edu> writes
>Sean 'Shaleh' Perry <shaleh at valinux.com> 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
>> coding.
>
>I find it ok for methodlike functions such as split.
>
>For unmethodlike functions such as join, I would use the old
>string.join syntax (for regular strings, anyways).
>
>"".join is just creepy.
>
>
it looks plain wrong, but would ['a','b','c'].join(';') look any better?

In fact there may be some benefit in being able to say

pathJoiner = (sys.platform=='win32' and ';' or ':').join
.....
path1 = pathJoiner([d1,d2,.....])
path2 = pathJoiner([e1,e2,.....])

-- 
Robin Becker



More information about the Python-list mailing list