[Python-bugs-list] [ python-Bugs-744051 ] sum() should be renamed

SourceForge.net noreply@sourceforge.net
Tue, 27 May 2003 10:51:21 -0700


Bugs item #744051, was opened at 2003-05-27 01:51
Message generated for change (Comment added) made by sbronson
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=744051&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: David Albert Torpey (dtorp)
Assigned to: Nobody/Anonymous (nobody)
Summary: sum() should be renamed

Initial Comment:
1. "sum" is a commonly used name for variables and 
functions at both the global and local levels.

2.  from Numeric import * (as recommended by Alex 
Martelli in Python in a Nutshell) will shadow the new 
builtin resulting in changed behavior for any functions 
using it.

In theory, namespaces make the problem irrelevant.  
In practice, it creates hard-to-find errors.  The conflict 
between __builtin__.open and os.open has been a 
small disaster.  To a lesser degree, __builtin__.pow 
and math.pow have a conflict.

It is not too late to fix this by choosing a less 
commonly used name:  summation, addall, 
addsequence, sigma, sumsequence, addit or anything 
that isn't already being used.

----------------------------------------------------------------------

Comment By: Samuel Bronson (sbronson)
Date: 2003-05-27 13:51

Message:
Logged In: YES 
user_id=237753

The locals are not a big problem, as long as functions are a
reasonable size. Is sum really that common at the global level?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=744051&group_id=5470