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

SourceForge.net noreply@sourceforge.net
Sat, 14 Jun 2003 20:54:33 -0700


Bugs item #744051, was opened at 2003-05-26 22:51
Message generated for change (Comment added) made by bcannon
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: Closed
>Resolution: Wont Fix
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: Brett Cannon (bcannon)
Date: 2003-06-14 20:54

Message:
Logged In: YES 
user_id=357491

I really don't see the name as being a problem.  No one from 
Numeric spoke up when this was being discussed on python-dev.  
If you grep the Lib/ directory from CVS the only instance of sum 
being used as a variable name is in Bastion.py and that is an 
instance attribute so it is accessed as self.sum .

Without getting a following from c.l.p to back this up this is not 
going to happen.  I am going to close this as "won't fix", but it 
can be opened again if you can prove the community wants a 
renaming.

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

Comment By: Samuel Bronson (sbronson)
Date: 2003-05-27 10: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