[Patches] [ python-Patches-724936 ] new sum builtin
SourceForge.net
noreply@sourceforge.net
Mon, 21 Apr 2003 05:21:45 -0700
Patches item #724936, was opened at 2003-04-21 06:33
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=724936&group_id=5470
Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 7
Submitted By: Alex Martelli (aleax)
Assigned to: Guido van Rossum (gvanrossum)
Summary: new sum builtin
Initial Comment:
as per discussion on Python-Dev. Note that
sum(manystrings), while still FAR faster than
reduce(operator.add, manystrings) and the equivalent loop,
is now about twice as slow as ''.join(manystrings) -- to
support the possibility that "manystrings" may be an
iterator, sum must retain the first item and
string-concatenate to it the ''.join of the others. I have not
mentioned this slight performance hit in the docs (just as
the far more severe performance trap with
reduce(operator.add, manystrings) is nowhere mentioned).
Also, I have not edited the tutorial. Please let me know if
you want more editing of such docs, I'll be quite glad to do
it, of course!
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2003-04-21 08:21
Message:
Logged In: YES
user_id=6380
I have to rethink the idea that sum() should only apply to
numbers. The discussion brought up some new good points that
I need to ponder.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=724936&group_id=5470