[Python-Dev] Rationale for sum()'s design?
Guido van Rossum
gvanrossum at gmail.com
Wed Mar 16 17:26:39 CET 2005
> 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.
Frankly, I've had enough of this exploration of alternative
definitions for sum(), and think it is perfect as it is.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list