Issue1093369

classification
Title: sum() builtin function.
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: bzimmer Nosy List: bzimmer, dsuch
Priority: normal Keywords: patch

Created on 2004-12-30.17:44:00 by dsuch, last changed 2005-02-19.21:15:33 by bzimmer.

Files
File name Uploaded Description Edit Remove
sum_builtin.patch dsuch, 2004-12-30.17:44:00 sum_builtin.patch
test_sum_builtin.py dsuch, 2004-12-30.17:45:45 test_sum_builtin.py
sumbuiltin.diff bzimmer, 2005-02-19.21:15:33
Messages
msg2397 (view) Author: Dariusz Suchojad (dsuch) Date: 2004-12-30.17:44:00
This simple patch adds sum() builtin to Jython. I
tested it with a minimal version (also attached) of
test_builtin.py from Python 2.3 test suite. Yes, I do
know sum() first  appears in Python 2.3, but sooner or
later Jython will also reach 2.3, hence this patch.

Diffed against today's build of new-style branch.

>>> import sys,os;sys.version;sys.platform
'2.2aNewstyle'
'java1.4.2_06'
msg2398 (view) Author: Brian Zimmer (bzimmer) Date: 2005-02-19.21:15:33
Logged In: YES 
user_id=37674

I rewrote the patch a bit to use Py.Zero, not check for null from _add 
since it will throw an exception on type problems and allow None as a 
result value since CPython does as well rather than defaulting to 0.  None 
as a result value results in a type error.
History
Date User Action Args
2004-12-30 17:44:00dsuchcreate