I come to praise .join, not to bury it...

Tim Peters tim.one at home.com
Sat Mar 3 17:47:15 EST 2001


[Alex Martelli, with a wonderfully on-target explanation of why it's
 sep.join(seq) and not seq.join(sep)]

Another reason could be that Guido is a dictator, and, like all dictators,
he's interested in killing off the various opposition groups that arise from
time to time.  Now any dictator would be mad to believe that the opposition
will be cooperative enough to implement a method that lets him kill them off
by passing an instrument of execution:

    future_haters.kill(knife)
    curly_brace_lovers.kill(slow_strangulation)

This puts it outside his control!  Much better for him if opposition groups
merely agree to enumerate themselves (and they probably need to have such a
protocol anyway, if for no other reason than to count their burgeoning
numbers).  Then he can satisfy his blood lust via simply teaching his weapons
of mass destruction how to enumerate collections of people:

    poison.kill(coalition_for_less_frequent_releases)
    neutron_bomb.kill(coalition_for_more_frequent_releases)

Guido can deal with the enumeration mechanics just once then, in his
LethalWeapons base class.

Unfortunately, plain "kill" on its own doesn't make clear which is being
killed and which is the instrument of death.  Ditto for plain "join".
Perhaps this whole brouhaha could have been avoided had we named
sep.join(seq) as sep.joining(seq) instead?  Yuck.  Anyone who suggests that
will be shot <wink>.

hoping-i'm-not-spilling-too-many-of-guido's-secrets-ly y'rs  - tim





More information about the Python-list mailing list