restriction on sum: intentional bug?

Aahz aahz at
Sat Oct 17 22:49:30 CEST 2009

In article <7e905311-c561-4b93-9414-f873e6fee533 at>,
Mark Dickinson  <dickinsm at> wrote:
>For some reason that I don't really understand, the CPython source does
>the equivalent of concat2 instead of concat3.  See the builtin_sum
>function in
>and scroll past the special cases for ints and floats.  After a
>one- line source change, replacing the PyNumber_Add call with

Ahhh, I vaguely remember there being some discussion of this when sum()
was introduced -- I think that using InPlaceAdd would have caused bad
behavior when the initial list was referred to by multiple names.
Aahz (aahz at           <*>

"To me vi is Zen.  To use vi is to practice zen.  Every command is a
koan.  Profound to the user, unintelligible to the uninitiated.  You
discover truth everytime you use it."  --reddy at

More information about the Python-list mailing list