On 4/27/06, Barry Warsaw <[EMAIL PROTECTED]> wrote:
> On Thu, 2006-04-27 at 10:08 -0700, Aahz wrote:
>
> > While I hate the way it looks, I never have gotten mixed up about the
> > order of arguments since switching to ''.join(l).
>
> 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)
I think I would prefer a signature of:
join(seq, joiner='')
Rationale: an emptystring joiner is the most frequent cases, but
several others (space, newline, space-comma, ...) occur often enough
to be worth allowing the joiner to be optionally specified.
The ability to omit the joiner in most cases works particularly well
with genexps, e.g.
join(str(x) for x in whatever)
ve
join('', (str(x) for x in whatever))
Alex
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com