No 1.6! (was Re: A REALLY COOL PYTHON FEATURE:)

Carel Fellinger cfelling at iae.nl
Thu May 18 20:14:51 EDT 2000


Peter Schneider-Kamp <petersc at stud.ntnu.no> wrote:
> Martijn Faassen wrote:
>> In the case of 'foo'.join() this stops making sense:
>>   I join the list of strings with spaces.
>> 
>>   ' '.join(list)

> Well how about this:
>   The space joins the elements of the list.

>   ' '.joins(list)

O Peter, please let's keep Python imperative:)
So what about:

   Hey SpaceMan, please join this string, will you?

And ofcourse SpaceMan will do a different job then Mr NewLine himself.

>> lots-of-instinctive-language-analysis-ly yours,

A little knowledge wouldn't hurt though:)

In the new objectivied usages of join, actually *different* joins are used.
We have a transitive and an intransitive usage of join. In the old form
it was clear what join was used, so this didn't cause any extra ambiguity.
 
>>> join(list, space)
###   transitive    ~>  Join these strings with a space.

We merely let the computer do the work, and even with the rejected
alternative new form:

>>> list.join(space)
###   intransitive  ~>  Strings, group together with a space in between.
###   transitive    ~>  Strings, become united by this space.

there is no problemo as both readings result in the same end state.
But elas, in the currently much debated form:

>>> space.join(list)
###   intransitive  ~>  Space, become a member of this list.
###   transitive    ~>  Space, unite the strings in this list.

we have two different readings, both valid from a linguistic point of view,
but the first is clearly not wat the interface designer had in mind:(
To make things worse, the intransitive usage of join is listed first in my
dictionary, implying it's the more occurring form. So either we prepare,
and do a field study showing that the transitive reading is by far the
predominant reading of this particular snipped, or we ban it!

O, and I use this "Space, unit..." form because python is an imperetative
language, so I prefer to use the imperative form of the verb in question.
And as it is not a imperatative statement in general, but addressed to a
specific thing, I attract its attention first by calling its name loud.


O, and yes I'm aware that I didn't play fair with the list.join part.
I should have transcribed it like:
   List, group together your strings with a space in between.
   List, make your strings united by a space.

-- 
groetjes, carel



More information about the Python-list mailing list