Numpy Not Allowing Use of Python 'Sum' Function?
Question: I just installed Pylab and Matplotlib to create a graph that is all working
fine. Then I went to open another python file for my program and noticed an
error:

    
    
        Traceback (most recent call last):
      File "C:\Python34\lib\site-packages\numpy\core\fromnumeric.py", line 1708, in sum
        sum = a.sum
    AttributeError: 'list' object has no attribute 'sum'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\Users\JD\git\ComputingCoursework\Coursework\Implementation\Files\AddDataGUI.py", line 768, in <module>
        launcher = AddDataWindow('Hardware')
      File "C:\Users\JD\git\ComputingCoursework\Coursework\Implementation\Files\AddDataGUI.py", line 33, in __init__
        self.col = sum([[i,''] for i in self.col],[])   ## adds a space in between each item in self.col tuple
      File "C:\Python34\lib\site-packages\numpy\core\fromnumeric.py", line 1711, in sum
        out=out, keepdims=keepdims)
      File "C:\Python34\lib\site-packages\numpy\core\_methods.py", line 32, in _sum
        return umr_sum(a, axis, dtype, out, keepdims)
    TypeError: cannot perform reduce with flexible type
    

Here is the code that seems to be causing an error

    
    
    self.col = sum([[i,''] for i in self.col],[])
    

It has been workig fine before numpy was installed? HELP!


Answer: Never use `from pylab import *` or `from numpy import *` since these imports
would overwrite the builtin definition of sum with NumPy's sum function. Use
of one of these imports might be the cause of the problem you are seeing.
Instead use `import numpy as np` so you can control access to NumPy functions
explicitly (e.g. with `np.sum`).

Other reasons to avoid using `from module import *` in general are that it
pollutes the global namespace and makes it harder to trace where variables
have been defined.

