[Python-Dev] OOps (was: No 1.6! (was Re: A REALLY COOL PYTHON FEATURE:))

Christian Tismer tismer@tismer.com
Sat, 13 May 2000 23:48:37 +0200


Gordon McMillan wrote:
> 
> Christian wrote:
> 
> > The split/join issue is really on the edge where I begin to not
> > like it. It is clear that the join method *must* be performed as
> > a method of the joining character, since the method expects a
> > list as its argument.
> 
> We've been through this a number of times on c.l.py.

I know. It just came up when I really used it, when
I read through this huge patch from Fred Gansevles, and when
I see people wondering about it.
After all, it is no surprize. They are right.
If we have to change their mind in order to understand
a basic operation, then we are wrong, not they.

> "What is this trash - I want list.join(sep)!"
> 
> After some head banging (often quite violent - ie, 4 or 5
> exchanges), they get that list.join(sep) sucks. But they still
> swear they'll never use sep.join(list).
> 
> So you end up saying "Well, string.join still works".

And it is the cleanest possible way to go, IMHO.
Unless we had some compound object methods, like

(somelist, somestring).join()

> We'll need a pre-emptive FAQ entry with the link bound to a
> key stroke. Or a big increase in the PSU budget...

We should reconsider the OO pattern.
The user's complaining is natural. " ".join() is not.
We might have gone too far. 

Python isn't just OO, it is better.

Joining lists of strings is joining lists of strings.
This is not a method of a string in the first place.
And not a method od a sequence in the first place.

Making it a method of the joining string now appears to be
a hack to me. (Sorry, Tim, the idea was great in the first place)

I am now
+1 on leaving join() to the string module
-1 on making some filler.join() to be the preferred joining way.

this-was-my-most-conservative-day-since-years-ly y'rs - chris

-- 
Christian Tismer             :^)   <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com