summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2014-07-31 19:04:11 -0600
committerCharles Harris <charlesr.harris@gmail.com>2014-07-31 19:07:38 -0600
commit275b1dd62f125e6a92cc64f69c2ce2154799717a (patch)
treeb40b3b0bdaf420622d61ecef7c712c55829b0a75
parent56471a170eee1c4694cde1889b8532e25f40e5d0 (diff)
downloadnumpy-275b1dd62f125e6a92cc64f69c2ce2154799717a.tar.gz
BUG: Fix None comparison giving FutureWarning in choice function.
This is in numpy/random/mtrand/mtrand.pyx where the choice function was using comparisons of the form `None != p`.
-rw-r--r--numpy/random/mtrand/mtrand.pyx6
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx
index c2603543d..31c8ab575 100644
--- a/numpy/random/mtrand/mtrand.pyx
+++ b/numpy/random/mtrand/mtrand.pyx
@@ -1068,7 +1068,7 @@ cdef class RandomState:
if pop_size is 0:
raise ValueError("a must be non-empty")
- if None != p:
+ if p is not None:
d = len(p)
p = <ndarray>PyArray_ContiguousFromObject(p, NPY_DOUBLE, 1, 1)
pix = <double*>PyArray_DATA(p)
@@ -1090,7 +1090,7 @@ cdef class RandomState:
# Actual sampling
if replace:
- if None != p:
+ if p is not None:
cdf = p.cumsum()
cdf /= cdf[-1]
uniform_samples = self.random_sample(shape)
@@ -1103,7 +1103,7 @@ cdef class RandomState:
raise ValueError("Cannot take a larger sample than "
"population when 'replace=False'")
- if None != p:
+ if p is not None:
if np.count_nonzero(p > 0) < size:
raise ValueError("Fewer non-zero entries in p than size")
n_uniq = 0