A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-March/052244.html below:

[Python-Dev] Rationale for sum()'s design?

[Python-Dev] Rationale for sum()'s design? [Python-Dev] Rationale for sum()'s design?Nick Coghlan ncoghlan at iinet.net.au
Thu Mar 17 15:54:02 CET 2005
Guido van Rossum wrote:
>>I guess that leaves Alex's question of whether or not supplying a string of some
>>description as the initial value can be legitimately translated to:
>>
>>   if isinstance(initial, basestring):
>>     return initial + type(initial)().join(seq)
> 
> 
> If you're trying to get people in the habit of writing sum(x, "")
> instead of "".join(x), I fear that they'll try sum(x, " ") instead of
> " ".join(x), and be sadly disappointed.

That works for me as a reason not to provide this feature.

It's somewhat heartening when discussions like this turn out to show that the 
original design was right after all :)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4