Gareth McCaughan wrote:
> (Attention conservation notice: the following is concerned almost entirely
> with exegesis of an old python-dev thread. Those interested in improving 
> Python
> and not in history and exegesis should probably ignore it.)
> 
> On Tuesday 2006-07-11 13:43, Boris Borcic wrote:
> 
>>>> I believe that in this case native linguistic intuition made the 
>>>> decision...
>>> The reason has nothing to do with language. Guido didn't
>>> want sum() to become an attractive nuisance by *appearing*
>>> to be an obvious way of joining a list of strings, while
>>> actually being a very inefficient way of doing that.
>> sum() *is* exactly an attractive nuisance by *appearing* to be an obvious 
>> way of 
>> chaining strings in a list (without actually being one).
> 
> It is a *short-term* attractive nuisance; anyone who tries it
> will quickly find that it can't be used to "sum" strings;
> whereas if this functionality of sum() had been retained
> then users would much more readily have been led to use it
> *and leave it in their programs*, to the detriment of their
> efficiency.
> 
>>> Considerable effort was put into trying to make sum()
>>> smart enough to detect when you were using it on a
>>> list of strings and do "".join behind the scenes, but
>>> Guido decided in the end that it wasn't worth the
>>> trouble, given that he only ever intended sum() to
>>> be used on numbers in the first place.
>> That's not quite conform to the record. According to py-dev archives it 
>> happened 
>> on April 2003 with a thread "Fwd: summing a bunch of numbers (or 
>> "whatevers")" 
>> initiated by Alex Martelli where he actually proposed a working 
>> implementation 
>> of sum() in C, that did short-circuit the case of strings to ''.join. That 
>> was 
>> Sat 19th of April.
>>
>> Debate ensued, and by late Sunday 20th around 11PM;, the honorable author of 
>> the 
>> Zen of Python had killed that use case for sum() with 
>> "sum(sequence_of_strings) 
>> hurts my brain". (Hello Tim, so what about  < sqrt(':(') >  ?)
> 
> Hardly "killed", since discussion of sum(stringseq) continued after
> Tim's comment, and since Tim was neither the only, nor the first, nor
> (I think) the last, person to object to sum(stringseq).
> 
>> Guido's first intervention in the thread was the next morning, and the two 
>> very 
>> first lines of his intervention where :
>>
>> "OK, let me summarize and pronounce.
>>
>>   sum(sequence_of_strings) is out...."
>>
>> I admit that there is a step of arguable interpretation from these recorded 
>> facts to my diagnostic, but the latter is compatible with the facts. Your 
>> version otoh looks more robust in the role of eg creation myth.
> 
> Your interpretation is only "compatible with the facts" by means
> of the hypothesis that Guido, despite saying "OK, let me summarize
> and pronounce" (which, incidentally, was the *actual* opening of
> that message, which was not Guido's first intervention in the
> thread, but who cares about facts?), had only read Tim Peters's
> message and not the rest of the thread. Including, for instance,
> one of the last messages before Guido's, from Alex, reporting that
> his sum() concatenated strings twice as slowly as ''.join. It also
> requires one to ignore the fact that Guido said (in that same
> message that you described as his "first intervention")
> 
>   |                       OTOH if we provide *any* way of providing a
>   | different starting point, some creative newbie is going to use
>   | sum(list_of_strings, "") instead of "".join(), and be hurt by the
>   | performance months later.
> 
> and the fact that in Guido's *actual* "first intervention" he
> said that he found sum(stringseq) "weird" and would continue to
> use ''.join. (Remark: Guido is not a native speaker of English,
> though he's a very competent one.) For that matter, Tim's
> comment about sum(stringseq) hurting his brain was in direct
> response to another part of that same message from Guido in
> which he said that "the name sum() strongly suggests that it's
> summing up numbers". (Remark: Guido still isn't a native speaker
> of English.)
> 
> Perhaps the fact that "sum" isn't a natural English term for
> concatenation of strings -- which, indeed, it isn't -- was one
> of his reasons; it demonstrably wasn't the only one; and it
> seems to have been the non-native speaker Guido himself who
> introduced that consideration to the discussion.
> 
> It appears to me that your interpretation is difficult to reconcile
> with the facts and is based on an incorrect and narrow reading of the
> original texts. What was that you were saying about creation myths?
> 
> (I agree that Greg's interpretation is also not well supported
> by that thread; I don't know whether Guido later said anything
> that would determine how much truth there is in it. Since sum()
> was Alex Martelli's invention, it seems unlikely that Greg's
> quite right.)
> 

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to