[Python-3000] Automatically invoking str() in str.join()
Brett Cannon
brett at python.org
Fri Apr 28 05:41:01 CEST 2006
On 4/27/06, Tim Peters <tim.peters at gmail.com> wrote:
> [Fredrik Lundh]
> > no, because people enjoy writing readable code. doing things by exe-
> > cuting methods attached to literals isn't very readable, and isn't used
> > for anything else.
>
> As Barry often says, he spells it TAB.join() or BLANK.join() (etc)
> instead. That's very readable.
>
> > I don't think anyone on this list can take the "but if there's more than
> > one argument, *I* am going to be confused" argument seriously.
>
> Then you don't remember that the order of arguments here _was_ a
> frequent confusion in the old days. If you like a callable with
> separator first, you can also do
>
> join = str.join
>
> today, and if you like a callable with separator second, you can also do
>
> from string import join
>
> today. My bet is that nobody here uses either, because they don't
> really find the method spelling distasteful enough to endure the
> one-line bother to set up an alternative that would flood their soul
> with joy ;-)
>
Right, but I am thinking of the newbies for this. I remember when I
learned Python and I thought the way str.join() worked was weird (and
I still do, although I understand why it how it is). Granted we could
just let string concatenation through '+' be more prominent, but we
all know the performance issues of looping through an iterator to
concatenate strings.
> If you want a builtin instead in Py3K, I'm just -0 on that (but -1 if
> that's in _addition_ to the three spellings Python already has).
I wouldn't want it added without ditching the other two versions as
well. Personally I would be fine if string.join() stayed and we
considered removing str.join() and just made the string module more
prominent (after removing all the deprecated stuff).
-Brett
More information about the Python-3000
mailing list