Improving Python (was: Lambda going out of fashion)
Fredrik Lundh
fredrik at pythonware.com
Mon Dec 27 03:50:36 EST 2004
Dima Dorfman wrote:
> I happen to not mind the ''.join syntax, but if I did, I would use
>
> str.join('', seq)
>
> which is just like a join builtin except that it's not as easy to make
> it work on pre-string-method Pythons.
just like join, except that it isn't:
>>> string.join(seq, sep)
u'axbxc'
>>> sep.join(seq)
u'axbxc'
>>> str.join(sep, seq)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: descriptor 'join' requires a 'str' object but received a 'unicode'
</F>
More information about the Python-list
mailing list