[Python-3000] Automatically invoking str() in str.join()

Tim Hochberg tim.hochberg at ieee.org
Thu Apr 27 19:24:43 CEST 2006


Barry Warsaw wrote:
> On Thu, 2006年04月27日 at 10:08 -0700, Aahz wrote:
 >> -0
>>>>>>While I hate the way it looks, I never have gotten mixed up about the
>>order of arguments since switching to ''.join(l).

Me too on all counts including the -0.
>>> Which is why
>> EMPTYSTRING = ''
>> ...
>> EMPTYSTRING.join(seq)
>> looks much better. But hey, yeah, a join() builtin would be fine if it
> took the string arg first, so that
>> ''.join(seq) == join('', seq)
>
Isn't that the same as str.join?
 >>> str.join(', ', 'abcdefg')
'a, b, c, d, e, f, g'
In which case why would we need a builtin?
-tim


More information about the Python-3000 mailing list

AltStyle によって変換されたページ (->オリジナル) /