Re: [Numpy-discussion] Numpy 'None' comparison FutureWarning

2015-01-31 Thread Sebastian Berg
On Sa, 2015-01-31 at 09:02 -0500, Benjamin Root wrote: > Finally got off my butt and hunted down an example, and it was right > under my nose in mplot3d. > > lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py:1094: > FutureWarning: comparison to `None` will result in an elementwise object

Re: [Numpy-discussion] Numpy 'None' comparison FutureWarning

2015-01-31 Thread Benjamin Root
Finally got off my butt and hunted down an example, and it was right under my nose in mplot3d. lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py:1094: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future. if self.button_pressed in self._rotat

Re: [Numpy-discussion] Numpy 'None' comparison FutureWarning

2014-09-21 Thread Nathaniel Smith
On 22 Sep 2014 03:02, "Demitri Muna" wrote: > > > On Sep 21, 2014, at 5:19 PM, Eric Firing wrote: > >> I think what you are missing is that the standard Python idiom for this >> use case is "if self._some_array is None:". This will continue to work, >> regardless of whether the object being chec

Re: [Numpy-discussion] Numpy 'None' comparison FutureWarning

2014-09-21 Thread Demitri Muna
On Sep 21, 2014, at 5:19 PM, Eric Firing wrote: > I think what you are missing is that the standard Python idiom for this > use case is "if self._some_array is None:". This will continue to work, > regardless of whether the object being checked is an ndarray or any > other Python object. T

Re: [Numpy-discussion] Numpy 'None' comparison FutureWarning

2014-09-21 Thread Benjamin Root
That being said, I do wonder about related situations where the lhs of the equal sign might be an array, or it might be a None and you are comparing against another numpy array. In those situations, you aren't trying to compare against None, you are just checking if two objects are equivalent. Wh

Re: [Numpy-discussion] Numpy 'None' comparison FutureWarning

2014-09-21 Thread Eric Firing
On 2014/09/21, 11:10 AM, Demitri Muna wrote: > Hi, > > I just encountered the following in my code: > > FutureWarning: comparison to `None` will result in an elementwise object > comparison in the future. > > I'm very concerned about this. This is a very common programming pattern > (lazy loading):

[Numpy-discussion] Numpy 'None' comparison FutureWarning

2014-09-21 Thread Demitri Muna
Hi, I just encountered the following in my code: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future. I'm very concerned about this. This is a very common programming pattern (lazy loading): class A(object): def __init__(self): self._s