[Numpy-discussion] Why am I getting a FutureWarning with this code?

Steve Spicklemire steve at SPVI.com
Mon Dec 22 10:35:25 EST 2014


I’m working on visual python (http://vpython.org) which lists numpy among its dependencies.

I recently updated my numpy installation to 1.9.1 and I’m now encountering this error:

/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/VPython-6.10-py2.7-macosx-10.10-x86_64.egg/visual_common/materials.py:70: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  self.__setattr__(key, value)

Oddly, the code in question looks like this:


     62 from . import cvisual
     63 from numpy import array, reshape, fromstring, ubyte, ndarray, zeros, asarray
     64 import os.path, math
     65 
     66 class raw_texture(cvisual.texture):
     67     def __init__(self, **kwargs):
     68         cvisual.texture.__init__(self)
     69         for key, value in kwargs.items():
     70             self.__setattr__(key, value)
     71 
     72 class shader_material(cvisual.material):
     73     def __init__(self, **kwargs):
     74         cvisual.material.__init__(self)
     75         for key, value in kwargs.items():
     76             self.__setattr__(key, value)

I’m not clear on how __setattr__ is being called out as an array comparison. 

help?

thanks,
-steve





More information about the NumPy-Discussion mailing list