[Python-3000] Python 3000 Status Update (Long!)
Bill Janssen
janssen at parc.com
Thu Jun 21 18:19:04 CEST 2007
> Multiple additions (with "+") mean "sum" in
> arithmetic, but you can't generalize that to strings
> and text processing. The "+" operator for any two
> strings is not about adding--it's about
> joining/concatenating. So multiple applications of
> "+" on strings aren't a sum. They're just a longer
> join/concatenation.
Hmmm. Your argument would be more pursuasive if you couldn't do this
in Python:
>>> a = "abc" + "def" + "ghi" + "jkl"
>>> a
'abcdefghijkl'
>>>
The real problem with "sum", I think, is that the parameter list is
ill-conceived (perhaps because it was added before variable length
parameter lists were?). It should be
sum(*operands)
not
sum(operands, initialvalue=?)
It should amount to "map(+, operands)".
Bill
More information about the Python-3000
mailing list