gah! I hate the new string syntax
Sean 'Shaleh' Perry
shaleh at valinux.com
Fri Mar 2 11:42:09 EST 2001
On 02-Mar-2001 Robin Becker wrote:
> 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,.....])
>
good ole:
from string import join
l = join(';', ['a','b','c']) # thanks, this is clear and obvious
Please o' gods of python, do not deprecate the clean and obvious syntax that is
found in the string module.
More information about the Python-list
mailing list