[Scipy-svn] r3516 - in trunk/scipy: maxentropy ndimage optimize sandbox/newoptimize sandbox/plt sandbox/xplt sparse stats weave

scipy-svn@scip... scipy-svn@scip...
Mon Nov 12 22:33:12 CST 2007


Author: jarrod.millman
Date: 2007-11-12 22:33:01 -0600 (Mon, 12 Nov 2007)
New Revision: 3516

Modified:
   trunk/scipy/maxentropy/maxentropy.py
   trunk/scipy/ndimage/_ni_support.py
   trunk/scipy/ndimage/filters.py
   trunk/scipy/ndimage/fourier.py
   trunk/scipy/ndimage/interpolation.py
   trunk/scipy/ndimage/measurements.py
   trunk/scipy/ndimage/morphology.py
   trunk/scipy/optimize/minpack.py
   trunk/scipy/optimize/tnc.py
   trunk/scipy/sandbox/newoptimize/tnc.py
   trunk/scipy/sandbox/plt/wxplt.py
   trunk/scipy/sandbox/xplt/gist.py
   trunk/scipy/sandbox/xplt/movie.py
   trunk/scipy/sandbox/xplt/pl3d.py
   trunk/scipy/sandbox/xplt/plwf.py
   trunk/scipy/sandbox/xplt/shapetest.py
   trunk/scipy/sandbox/xplt/slice3.py
   trunk/scipy/sparse/sparse.py
   trunk/scipy/stats/stats.py
   trunk/scipy/weave/accelerate_tools.py
   trunk/scipy/weave/bytecodecompiler.py
Log:
use identity tests (not equality tests) for None


Modified: trunk/scipy/maxentropy/maxentropy.py
===================================================================
--- trunk/scipy/maxentropy/maxentropy.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/maxentropy/maxentropy.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -639,9 +639,9 @@
     def __init__(self, f=None, samplespace=None):
         super(model, self).__init__()
 
-        if f != None and samplespace != None:
+        if f is not None and samplespace is not None:
             self.setfeaturesandsamplespace(f, samplespace)
-        elif f != None and samplespace is None:
+        elif f is not None and samplespace is None:
             raise ValueError, "not supported: specify both features and" \
                     " sample space or neither"
 
@@ -1550,7 +1550,7 @@
                     if self.verbose >= 2:
                         print "(using Deylon acceleration.  n is " + str(n) + " instead of " + str(k - self.a_0_hold) + "...)"
                 if self.ruppertaverage:
-                    if self.stepdecreaserate == None:
+                    if self.stepdecreaserate is None:
                         # Use log n / n as the default.  Note: this requires a
                         # different scaling of a_0 than a stepsize decreasing
                         # as, e.g., n^(-1/2).

Modified: trunk/scipy/ndimage/_ni_support.py
===================================================================
--- trunk/scipy/ndimage/_ni_support.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/ndimage/_ni_support.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -64,12 +64,12 @@
 
 import warnings
 def _get_output(output, input, output_type = None, shape = None):
-    if output_type != None:
+    if output_type is not None:
         msg = "'output_type' argument is deprecated."
         msg += " Assign type to 'output' instead."
         raise RuntimeError, msg
         warnings.warn(msg, DeprecationWarning)
-        if output == None:
+        if output is None:
             output = output_type
         elif ((type(output) is not type(types.TypeType)) or
               output.dtype != output_type):

Modified: trunk/scipy/ndimage/filters.py
===================================================================
--- trunk/scipy/ndimage/filters.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/ndimage/filters.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -516,8 +516,8 @@
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
     origins = _ni_support._normalize_sequence(origin, input.ndim)
-    if footprint == None:
-        if size == None:
+    if footprint is None:
+        if size is None:
             raise RuntimeError, "no footprint or filter size provided"
         sizes = _ni_support._normalize_sequence(size, input.ndim)
         footprint = numpy.ones(sizes, dtype = bool)
@@ -652,8 +652,8 @@
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
     origins = _ni_support._normalize_sequence(origin, input.ndim)
-    if footprint == None:
-        if size == None:
+    if footprint is None:
+        if size is None:
             raise RuntimeError, "no footprint or filter size provided"
         sizes = _ni_support._normalize_sequence(size, input.ndim)
         footprint = numpy.ones(size, dtype = bool)

Modified: trunk/scipy/ndimage/fourier.py
===================================================================
--- trunk/scipy/ndimage/fourier.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/ndimage/fourier.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -35,7 +35,7 @@
 import _nd_image
 
 def _get_output_fourier(output, input):
-    if output == None:
+    if output is None:
         if input.dtype.type in [numpy.complex64, numpy.complex128,
                                 numpy.float32]:
             output = numpy.zeros(input.shape, dtype = input.dtype)
@@ -55,7 +55,7 @@
     return output, return_value
 
 def _get_output_fourier_complex(output, input):
-    if output == None:
+    if output is None:
         if input.dtype.type in [numpy.complex64, numpy.complex128]:
             output = numpy.zeros(input.shape, dtype = input.dtype)
         else:

Modified: trunk/scipy/ndimage/interpolation.py
===================================================================
--- trunk/scipy/ndimage/interpolation.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/ndimage/interpolation.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -126,7 +126,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if output_shape == None:
+    if output_shape is None:
         output_shape = input.shape
     if input.ndim < 1 or len(output_shape) < 1:
         raise RuntimeError, 'input and output rank must be > 0'
@@ -229,7 +229,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if output_shape == None:
+    if output_shape is None:
         output_shape = input.shape
     if input.ndim < 1 or len(output_shape) < 1:
         raise RuntimeError, 'input and output rank must be > 0'

Modified: trunk/scipy/ndimage/measurements.py
===================================================================
--- trunk/scipy/ndimage/measurements.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/ndimage/measurements.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -48,7 +48,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if structure == None:
+    if structure is None:
         structure = morphology.generate_binary_structure(input.ndim, 1)
     structure = numpy.asarray(structure, dtype = bool)
     if structure.ndim != input.ndim:
@@ -65,7 +65,7 @@
         output = numpy.int32
     output, return_value = _ni_support._get_output(output, input)
     max_label = _nd_image.label(input, structure, output)
-    if return_value == None:
+    if return_value is None:
         return max_label
     else:
         return return_value, max_label
@@ -136,7 +136,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if labels != None:
+    if labels is not None:
         labels = numpy.asarray(labels)
         labels = _broadcast(labels, input.shape)
 
@@ -155,7 +155,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if labels != None:
+    if labels is not None:
         labels = numpy.asarray(labels)
         labels = _broadcast(labels, input.shape)
 
@@ -188,7 +188,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if labels != None:
+    if labels is not None:
         labels = numpy.asarray(labels)
         labels = _broadcast(labels, input.shape)
 
@@ -208,7 +208,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if labels != None:
+    if labels is not None:
         labels = numpy.asarray(labels)
         labels = _broadcast(labels, input.shape)
 
@@ -241,7 +241,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if labels != None:
+    if labels is not None:
         labels = numpy.asarray(labels)
         labels = _broadcast(labels, input.shape)
 
@@ -264,7 +264,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if labels != None:
+    if labels is not None:
         labels = numpy.asarray(labels)
         labels = _broadcast(labels, input.shape)
 
@@ -288,7 +288,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if labels != None:
+    if labels is not None:
         labels = numpy.asarray(labels)
         labels = _broadcast(labels, input.shape)
 
@@ -316,7 +316,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if labels != None:
+    if labels is not None:
         labels = numpy.asarray(labels)
         labels = _broadcast(labels, input.shape)
 
@@ -338,7 +338,7 @@
     input = numpy.asarray(input)
     if numpy.iscomplexobj(input):
         raise TypeError, 'Complex type not supported'
-    if labels != None:
+    if labels is not None:
         labels = numpy.asarray(labels)
         labels = _broadcast(labels, input.shape)
 
@@ -363,7 +363,7 @@
     input = numpy.asarray(input)
     if input.dtype.type not in [numpy.uint8, numpy.uint16]:
         raise TypeError, 'only 8 and 16 unsigned inputs are supported'
-    if structure == None:
+    if structure is None:
         structure = morphology.generate_binary_structure(input.ndim, 1)
     structure = numpy.asarray(structure, dtype = bool)
     if structure.ndim != input.ndim:

Modified: trunk/scipy/ndimage/morphology.py
===================================================================
--- trunk/scipy/ndimage/morphology.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/ndimage/morphology.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -128,7 +128,7 @@
             origin[ii] = -origin[ii]
             if not structure.shape[ii] & 1:
                 origin[ii] -= 1
-        if mask != None:
+        if mask is not None:
             msk = numpy.asarray(mask)
             msk = mask.astype(numpy.int8)
             if msk is mask:
@@ -141,7 +141,7 @@
         return return_value
     else:
         tmp_in = numpy.zeros(input.shape, bool)
-        if return_value == None:
+        if return_value is None:
             tmp_out = output
         else:
             tmp_out = numpy.zeros(input.shape, bool)
@@ -155,7 +155,7 @@
             changed = _nd_image.binary_erosion(tmp_in, structure, mask,
                             tmp_out, border_value, origin, invert, cit, 0)
             ii += 1
-        if return_value != None:
+        if return_value is not None:
             return tmp_out
 
 
@@ -190,7 +190,7 @@
     modified at each iteration.
     """
     input = numpy.asarray(input)
-    if structure == None:
+    if structure is None:
         structure = generate_binary_structure(input.ndim, 1)
     origin = _ni_support._normalize_sequence(origin, input.ndim)
     structure = numpy.asarray(structure)
@@ -544,7 +544,7 @@
         metric = 3
     else:
         raise RuntimeError, 'distance metric not supported'
-    if sampling != None:
+    if sampling is not None:
         sampling = _ni_support._normalize_sequence(sampling, tmp1.ndim)
         sampling = numpy.asarray(sampling, dtype = numpy.float64)
         if not sampling.flags.contiguous:
@@ -554,7 +554,7 @@
     else:
         ft = None
     if return_distances:
-        if distances == None:
+        if distances is None:
             if metric == 1:
                 dt = numpy.zeros(tmp1.shape, dtype = numpy.float64)
             else:

Modified: trunk/scipy/optimize/minpack.py
===================================================================
--- trunk/scipy/optimize/minpack.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/optimize/minpack.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -9,7 +9,7 @@
 
 def check_func(thefunc, x0, args, numinputs, output_shape=None):
     res = atleast_1d(thefunc(*((x0[:numinputs],)+args)))
-    if (output_shape != None) and (shape(res) != output_shape):
+    if (output_shape is not None) and (shape(res) != output_shape):
         if (output_shape[0] != 1):
             if len(output_shape) > 1:
                 if output_shape[1] == 1:

Modified: trunk/scipy/optimize/tnc.py
===================================================================
--- trunk/scipy/optimize/tnc.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/optimize/tnc.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -213,8 +213,8 @@
 
     """
     low, up   : the bounds (lists of floats)
-                if low == None, the lower bounds are removed.
-                if up == None, the upper bounds are removed.
+                if low is None, the lower bounds are removed.
+                if up is None, the upper bounds are removed.
                 low and up defaults to None
     """
     low = [0]*n
@@ -232,13 +232,13 @@
             else:
                 up[i] = u
 
-    if scale == None:
+    if scale is None:
         scale = []
 
-    if offset == None:
+    if offset is None:
         offset = []
 
-    if maxfun == None:
+    if maxfun is None:
         maxfun = max(100, 10*len(x0))
 
     rc, nf, x = moduleTNC.minimize(func_and_grad, x0, low, up, scale, offset,

Modified: trunk/scipy/sandbox/newoptimize/tnc.py
===================================================================
--- trunk/scipy/sandbox/newoptimize/tnc.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/sandbox/newoptimize/tnc.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -202,8 +202,8 @@
     low, up   : the bounds (lists of floats)
                 set low[i] to -HUGE_VAL to remove the lower bound
                 set up[i] to HUGE_VAL to remove the upper bound
-                if low == None, the lower bounds are removed.
-                if up == None, the upper bounds are removed.
+                if low is None, the lower bounds are removed.
+                if up is None, the upper bounds are removed.
                 low and up defaults to None
     """
     low = [0]*n
@@ -219,13 +219,13 @@
         else:
             up[i] = u
 
-    if scale == None:
+    if scale is None:
         scale = []
 
-    if offset == None:
+    if offset is None:
         offset = []
 
-    if maxfun == None:
+    if maxfun is None:
         maxfun = max(100, 10*len(x0))
 
     return moduleTNC.minimize(func_and_grad, x0, low, up, scale, offset,

Modified: trunk/scipy/sandbox/plt/wxplt.py
===================================================================
--- trunk/scipy/sandbox/plt/wxplt.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/sandbox/plt/wxplt.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -585,7 +585,7 @@
 
     def printout(self, paper=None):
         """Print current plot."""
-        if paper != None:
+        if paper is not None:
             self.print_data.SetPaperId(paper)
         pdd = wx.wxPrintDialogData()
         pdd.SetPrintData(self.print_data)

Modified: trunk/scipy/sandbox/xplt/gist.py
===================================================================
--- trunk/scipy/sandbox/xplt/gist.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/sandbox/xplt/gist.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -8,7 +8,7 @@
 #  SCIPY
 #  10/15/04 teo Added convert_bounding box.
 #  09/28/03 teo Changed eps file to accept noepsi when not available.
-#  09/28/03 teo Changed all == None to is None and != None to not is None
+#  09/28/03 teo Changed all is None to is None and is not None to not is None
 #
 #  CHANGES:
 #  11/08/04 mdh plh: Change test if color is a list; also test if array.

Modified: trunk/scipy/sandbox/xplt/movie.py
===================================================================
--- trunk/scipy/sandbox/xplt/movie.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/sandbox/xplt/movie.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -86,7 +86,7 @@
         elapsed0 = array(elapsed, copy = 1)
     i = i + 1
     more = draw_frame (i)
-    if lims != None:
+    if lims is not None:
         limits (lims [0], lims [1], lims [2], lims [3])
     else:
         limits (square = 1)
@@ -110,7 +110,7 @@
         this_frame = zeros (3)
         i = i + 1
         more = draw_frame (i)
-        if lims != None:
+        if lims is not None:
             limits (lims [0], lims [1], lims [2], lims [3])
         else :
             limits (square = 1)

Modified: trunk/scipy/sandbox/xplt/pl3d.py
===================================================================
--- trunk/scipy/sandbox/xplt/pl3d.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/sandbox/xplt/pl3d.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -191,9 +191,9 @@
     except :
         _orient3_phi = - pi / 4.
 
-    if kw.has_key ("phi") and kw ["phi"] == None :
+    if kw.has_key ("phi") and kw ["phi"] is None :
         kw ["phi"] = _orient3_phi
-    if kw.has_key ("theta") and kw ["theta"] == None :
+    if kw.has_key ("theta") and kw ["theta"] is None :
         kw ["theta"] = _orient3_theta
     if not kw.has_key ("phi") and not kw.has_key ("theta") :
         phi = _orient3_phi
@@ -257,7 +257,7 @@
 
     global _draw3_list, _draw3_view, _light3_list, _draw3_n
 
-    if view != None :
+    if view is not None :
         view = view [0:len (view)] # Copies view
     else :
         view = _draw3_view + _light3_list
@@ -318,30 +318,30 @@
     if len (kw) > 0 : kwds = kw [0]
     old = _draw3_list [_draw3_nv:] [0:5]
     flags = 0
-    if kwds.has_key ("ambient") and kwds ["ambient"] != None :
+    if kwds.has_key ("ambient") and kwds ["ambient"] is not None :
         ambient = kwds ["ambient"]
         if not is_scalar (ambient) :
             raise _AmbientError, "ambient light level must be scalar."
         flags = flags | 1
         _draw3_list [_draw3_nv] = ambient
-    if kwds.has_key ("diffuse") and kwds ["diffuse"] != None :
+    if kwds.has_key ("diffuse") and kwds ["diffuse"] is not None :
         diffuse = kwds ["diffuse"]
         if not is_scalar (diffuse) :
             raise _DiffuseError, "diffuse light level must be scalar."
         flags = flags | 2
         _draw3_list [_draw3_nv + 1 ] = diffuse
 
-    if kwds.has_key ("specular") and kwds ["specular"] != None :
+    if kwds.has_key ("specular") and kwds ["specular"] is not None :
         specular = kwds ["specular"]
         flags = flags | 4
     else :
         specular = _draw3_list [_draw3_nv + 2]
-    if kwds.has_key ("spower") and kwds ["spower"] != None :
+    if kwds.has_key ("spower") and kwds ["spower"] is not None :
         spower = kwds ["spower"]
         flags = flags | 8
     else :
         spower = _draw3_list [_draw3_nv + 3]
-    if kwds.has_key ("sdir") and kwds ["sdir"] != None :
+    if kwds.has_key ("sdir") and kwds ["sdir"] is not None :
         sdir = kwds ["sdir"]
         dims = shape (sdir)
         if dims == 0 or len (dims) == 2 and dims [1] != 3 :
@@ -595,7 +595,7 @@
 
     # do optional perspective projection
     zc = getzc3_ ()
-    if zc != None :
+    if zc is not None :
         if len (shp) == 2 :
             z = tmpxyz [:, 2]
             zc = maximum (zc - z, 1.e-35)     # protect behind camera, avoid zero divide
@@ -742,7 +742,7 @@
         window3 (current_window ())
     gnomon (_default_gnomon)
     lims = draw3 (1)
-    if lims == None :
+    if lims is None :
         return
     else :
         limits (lims [0], lims [1], lims [2], lims [3])
@@ -902,7 +902,7 @@
         # calls rather than the interactive setup calls
         set_draw3_ (1)
         list = _draw3_list [_draw3_n:]
-        no_lims = lims == None
+        no_lims = lims is None
         first = 1
         # ZCM Feb. 1997: Because Gist command 'limits' seems to
         # misbehave and be timing dependent, I have added the kludge
@@ -915,12 +915,12 @@
                     first = 0
                 else :
                     fv = fnc (list [1])
-                    if fv != None and lims != None :
+                    if fv is not None and lims is not None :
                         lims = [min (fv [0], lims [0]),
                                 max (fv [1], lims [1]),
                                 min (fv [2], lims [2]),
                                 max (fv [3], lims [3])]
-                    elif fv != None :
+                    elif fv is not None :
                         lims = fv
             else :
                 fnc (list [1])

Modified: trunk/scipy/sandbox/xplt/plwf.py
===================================================================
--- trunk/scipy/sandbox/xplt/plwf.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/sandbox/xplt/plwf.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -110,7 +110,7 @@
             jedge = tmp
             x = transpose (array (xyz1 [0]))
             y = transpose (array (xyz1 [1]))
-            if fill != None :
+            if fill is not None :
                 fill = transpose (fill)
         else :
             x = xyz1 [0]
@@ -123,12 +123,12 @@
         if iedge < 0.0 :
             x = reverse (x, 0)
             y = reverse (y, 0)
-            if fill != None :
+            if fill is not None :
                 fill = reverse (fill, 0)
         if jedge < 0.0 :
             x = reverse (x, 1)
             y = reverse (y, 1)
-            if fill != None :
+            if fill is not None :
                 fill = reverse (fill, 1)
         xmax = maxelt_ (x)
         xmin = minelt_ (x)
@@ -151,7 +151,7 @@
                 dif = (ydif - xdif) / 2.
                 xmin = xmin - dif
                 xmax = xmax + dif
-        if fill != None :
+        if fill is not None :
             if len (fill.shape) == 1:
                 fill = bytscl (fill)
             else:
@@ -159,29 +159,29 @@
                 l = fill.shape [1]
                 fill = reshape ( bytscl (ravel (fill)), (k, l))
         if cull == 0 : #transparent mesh
-            if ecolor != None :
+            if ecolor is not None :
                 plm (y, x, color = ecolor)
             else :
                 plm (y, x)
-        elif ecolor != None and ewidth != None and cmax != None :
+        elif ecolor is not None and ewidth is not None and cmax is not None :
             plf (fill, y, x, edges = edges, ecolor = ecolor,
                  ewidth = ewidth, cmin = 0.0, cmax = cmax, legend = "")
-        elif ecolor != None and ewidth != None :
+        elif ecolor is not None and ewidth is not None :
             plf (fill, y, x, edges = edges, ewidth = ewidth,
                  cmin = 0.0, ecolor = ecolor, legend = "")
-        elif ecolor != None and cmax != None :
+        elif ecolor is not None and cmax is not None :
             plf (fill, y, x, edges = edges, ecolor = ecolor,
                  cmin = 0.0, cmax = cmax, legend = "")
-        elif ewidth != None and cmax != None :
+        elif ewidth is not None and cmax is not None :
             plf (fill, y, x, edges = edges,  ewidth = ewidth,
                  cmin = 0.0, cmax = cmax, legend = "")
-        elif ecolor != None :
+        elif ecolor is not None :
             plf (fill, y, x, edges = edges, ecolor = ecolor,
                  cmin = 0.0, legend = "")
-        elif ewidth != None :
+        elif ewidth is not None :
             plf (fill, y, x, edges = edges, ewidth = ewidth,
                  cmin = 0.0, legend = "")
-        elif cmax != None :
+        elif cmax is not None :
             plf (fill, y, x, edges = edges,
                  cmin = 0.0, cmax = cmax, legend = "")
         else :
@@ -256,8 +256,8 @@
         raise _Xyz_wfError, "impossible dimensions for z array"
     nx = shape (z) [0]
     ny = shape (z) [1]
-    if y == None or x == None :
-        if x != None or y != None :
+    if y is None or x is None :
+        if x is not None or y is not None :
             raise _Xyz_wfError, "either give y,x both or neither"
         x = span (0, ny - 1, ny, nx)
         y = transpose (span (0, nx - 1, nx, ny))
@@ -265,7 +265,7 @@
         raise _Xyz_wfError, "x, y, and z must all have same dimensions"
     xyscl = max (maxelt_ (x) - minelt_ (x),
                  maxelt_ (y) - minelt_ (y))
-    if scale != None:
+    if scale is not None:
         xyscl = xyscl * scale
     dz = maxelt_ (z) - minelt_ (z)
     zscl= dz + (dz == 0.0)

Modified: trunk/scipy/sandbox/xplt/shapetest.py
===================================================================
--- trunk/scipy/sandbox/xplt/shapetest.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/sandbox/xplt/shapetest.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -17,7 +17,7 @@
 
 # This routine should be able to tell you the size of any object:
 def no_of_dims (x) :
-    if x == None : return 0
+    if x is None : return 0
     if isinstance(x, ndarray) : return len (x.shape)
     if isinstance(x, (list, tuple)) : return 1
     # I don't know if there are any other possibilities.

Modified: trunk/scipy/sandbox/xplt/slice3.py
===================================================================
--- trunk/scipy/sandbox/xplt/slice3.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/sandbox/xplt/slice3.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -126,8 +126,8 @@
     """
 
     dims = shape (x)
-    if len (dims) == 1 and y != None and len (x) == len (y) \
-       and z != None and len(x) == len (z) and kw.has_key ("verts") :
+    if len (dims) == 1 and y is not None and len (x) == len (y) \
+       and z is not None and len(x) == len (z) and kw.has_key ("verts") :
         virtuals = [xyz3_irreg, getv3_irreg,
                     getc3_irreg, iterator3_irreg]
         dims = kw ["verts"]
@@ -160,11 +160,11 @@
         xyz = x
         dims = dims [1:4]
     elif len (dims) == 1 and len (x) == 3 and type (x [0]) == IntType \
-       and y != None and z != None and len (y) == len (z) == 3 :
+       and y is not None and z is not None and len (y) == len (z) == 3 :
         xyz = array ([y, z])
         dims = (1 + x [0], 1 + x [1], 1 + x [2])
         virtuals [0] = xyz3_unif
-    elif len (dims) == 1 and y != None and z != None and len (y.shape) == 1 \
+    elif len (dims) == 1 and y is not None and z is not None and len (y.shape) == 1 \
        and len (z.shape) == 1 and x.typed  == y.typed == \
        z.typed == Float :
         # regular mesh with unequally spaced points
@@ -173,8 +173,8 @@
         virtuals [0] = xyz3_unif
     else :
         if len (dims) != 3 or min (dims) < 2 or \
-           y == None or len (shape (y)) != 3 or shape (y) != dims or \
-           z == None or len (shape (z)) != 3 or shape (z) != dims:
+           y is None or len (shape (y)) != 3 or shape (y) != dims or \
+           z is None or len (shape (z)) != 3 or shape (z) != dims:
             raise _Mesh3Error, "X,Y,Z are not viable 3D coordinate mesh arrays"
         xyz = array ( [x, y, z])
     dim_cell = (dims [0] - 1, dims [1] - 1, dims [2] - 1)
@@ -340,7 +340,7 @@
 
     if need_clist :
         fcolor = args [0]
-        if fcolor == None :
+        if fcolor is None :
             need_clist = 0
     else :
         fcolor = None
@@ -374,7 +374,7 @@
     results = []
     chunk = iterator3 (m3)
     cell_offsets = [0, 0, 0, 0]
-    while chunk != None :
+    while chunk is not None :
 
         # get the values of the slicing function at the vertices of
         # this chunk
@@ -400,7 +400,7 @@
             # front, and negative if in back.
         else :
             fs = fslice (m3, chunk)
-        if node == 1 and fcolor != None and fcolor != FunctionType :
+        if node == 1 and fcolor is not None and fcolor != FunctionType :
             # need vertex-centered data
             col = getv3 (fcolor, m3, chunk)
             if type (col) == ListType :
@@ -416,7 +416,7 @@
             cell_offset = fs [2]
 
         # will need cell list if fslice did not compute xyz
-        got_xyz = _xyz3 != None
+        got_xyz = _xyz3 is not None
         need_clist = need_clist or not got_xyz
 
         # If the m3 mesh is totally unstructured, the chunk should be
@@ -508,7 +508,7 @@
                 clist = None
             i8.append (len (results)) # Treat regular case as hex
 
-        if clist != None :
+        if clist is not None :
             #  we need to save:
             # (1) the absolute cell indices of the cells in clist
             # (2) the corresponding ncells-by-2-by-2-by-2 (by-3-by-2,
@@ -538,7 +538,7 @@
                        indices,axis=0), (no_cells, 2, 2, 2))
                     _xyz3 = new_xyz3
                     del new_xyz3
-                if col != None :
+                if col is not None :
                     col = reshape (take (ravel (col), indices,axis=0), (no_cells, 2, 2, 2))
                     # NB: col represents node colors, and is only used
                     # if those are requested.
@@ -549,12 +549,12 @@
             else :
                 clist = None
             nchunk = nchunk + 1
-            need_vert_col = col != None
+            need_vert_col = col is not None
             results.append ( [clist, fs, _xyz3, col])
         else :
             results.append ( [None, None, None, None])
         chunk = iterator3 (m3, chunk)
-        # endwhile chunk != None
+        # endwhile chunk is not None
 
     # collect the results of the chunking loop
     if not ntotal and not (ntotal8 + ntotal6 + ntotal5 + ntotal4) :
@@ -590,10 +590,10 @@
             if need_clist :
                 clist [l:k] = results [itot [i] [j]] [0]
             fs [l:k] = reshape (results [itot [i] [j]] [1], (k - l, _no_verts [i]))
-            if xyz != None :
+            if xyz is not None :
                 xyz [l:k] = reshape (results [itot [i] [j]] [2],
                    (k - l, 3, _no_verts [i]))
-            if col != None :
+            if col is not None :
                 col [l:k] = reshape (results [itot [i] [j]] [3],
                    (k - l, _no_verts [i]))
         if not got_xyz :
@@ -633,7 +633,7 @@
            take (ravel (xyz [:, 2]), upper,axis=0) * fsl), (len (lower),))
         xyz = new_xyz
         del new_xyz
-        if col != None :
+        if col is not None :
             # Extract subset of the data the same way
             col = take (ravel (col), lower,axis=0) * fsu - \
                take (ravel (col), upper,axis=0) * fsl
@@ -669,7 +669,7 @@
         xyz1 [:,1] = take (ravel (xyz [:,1]), order,axis=0)
         xyz1 [:,2] = take (ravel (xyz [:,2]), order,axis=0)
         xyz = xyz1
-        if col != None :
+        if col is not None :
             col = take (col, order,axis=0)
         edges = take (edges, order,axis=0)
         pattern = take (pattern, order,axis=0)
@@ -703,15 +703,15 @@
         xyzverts = xyz
 
         # finally, deal with any fcolor function
-        if fcolor == None :
+        if fcolor is None :
             new_results.append ( [nverts, xyzverts, None])
             continue
 
         # if some polys have been split, need to split clist as well
         if len (list) > len (clist) :
             clist = take (clist, take (cells, list, axis=0),axis=0)
-        if col == None :
-            if nointerp == None :
+        if col is None :
+            if nointerp is None :
                 if type (fcolor) == FunctionType :
                     col = fcolor (m3, clist + cell_offsets [i], lower, upper, fsl,
                        fsu, pattern - 1)
@@ -731,7 +731,7 @@
     for i in range (len (new_results)) :
         nv_n = nv_n + len (new_results [i] [0])
         xyzv_n = xyzv_n + shape (new_results [i] [1]) [0]
-        if new_results [i] [2] != None :
+        if new_results [i] [2] is not None :
             col_n = col_n + len (new_results [i] [2])
     nverts = zeros (nv_n, Int)
     xyzverts = zeros ( (xyzv_n, 3), Float )
@@ -747,7 +747,7 @@
         xyzv_n2 = shape (new_results [i] [1]) [0]
         nverts [nv_n1:nv_n1 + nv_n2] = new_results [i] [0]
         xyzverts [xyzv_n1:xyzv_n1 + xyzv_n2] = new_results [i] [1]
-        if new_results [i] [2] != None :
+        if new_results [i] [2] is not None :
             col_n2 = len (new_results [i] [2])
             col [col_n1:col_n1 + col_n2] = new_results [i] [2]
             col_n1 = col_n1 + col_n2
@@ -882,7 +882,7 @@
         color = kw ["color"]
     else :
         color = None
-    if color != None :
+    if color is not None :
 #     col = array (len (nverts), Float )
         if shape (color) == (ncx - 1, ncy - 1) :
             col = color
@@ -1013,7 +1013,7 @@
 
     global _chunk3_limit
 
-    if chunk == None :
+    if chunk is None :
         dims = m3 [1] [0]      # [ni,nj,nk] cell dimensions
         [ni, nj, nk] = [dims [0], dims [1], dims [2]]
         njnk = nj * nk
@@ -1039,7 +1039,7 @@
         nk = chunk [3,2]
         njnk = nj * nk
         offsets = array ( [njnk, nj, 1], Int)
-        if clist != None :
+        if clist is not None :
             # add offset for this chunk to clist and return
             return sum (offsets * ( chunk [0] - 1),axis=0) + clist
 
@@ -1136,14 +1136,14 @@
 
     global _chunk3_limit
 
-    if clist != None:
+    if clist is not None:
         return clist
 
     dims = m3 [1] [0]     # ncells by _no_verts array of subscripts
                           # (or a list of from one to four of same)
 
     if type (dims) != ListType :
-        if chunk == None:     # get the first chunk
+        if chunk is None:     # get the first chunk
             return [ [0, min (shape (dims) [0], _chunk3_limit)],
                      arange (0, min (shape (dims) [0], _chunk3_limit),
                      dtype = Int)]
@@ -1158,7 +1158,7 @@
                          dtype = Int)]
     else :
         totals = m3 [1] [3] # cumulative totals of numbers of cells
-        if chunk == None :
+        if chunk is None :
             return [ [0, min (totals [0], _chunk3_limit)],
                      arange (0, min (totals [0], _chunk3_limit),
                      dtype = Int)]
@@ -1380,7 +1380,7 @@
             no_cells = shape (indices) [0]
             indices = ravel (indices)
             corners = take (ravel (fi [i - 1]), indices,axis=0)
-            if l == None :
+            if l is None :
                 return 0.125 * sum (transpose (reshape (corners, (no_cells, 8))),axis=0)
             else :
                 # interpolate corner values to get edge values
@@ -1467,7 +1467,7 @@
     no_cells = shp [0]
     indices = ravel (indices)
     corners = take (fi [i - 1], indices,axis=0)
-    if l == None :
+    if l is None :
         return (1. / shp [1]) * transpose ((sum (transpose (reshape (corners,
            (no_cells, shp [1]))) [0:shp [1]],axis=0)))
     else :
@@ -1615,7 +1615,7 @@
       If CLEAR = 1, clear the display list first.
       If EDGES = 1, plot the edges.
       The algorithm is to apply slice2x repeatedly to the surface.
-      If color == None, then bytscl the palette into N + 1 colors
+      If color is None, then bytscl the palette into N + 1 colors
       and send each of the slices to pl3tree with the appropriate color.
       If color == "bg", will plot only the edges.
       If CMIN is given, use it instead of the minimum z actually
@@ -1635,13 +1635,13 @@
     # 1. Get contour colors
     if type (contours) == IntType :
         n = contours
-        if cmin != None :
+        if cmin is not None :
             vcmin = cmin
             minz = min (xyzverts [:, 2])
         else :
             vcmin = min (xyzverts [:, 2])
             minz = vcmin
-        if cmax != None :
+        if cmax is not None :
             vcmax = cmax
             maxz = max (xyzverts [:, 2])
         else :
@@ -1692,14 +1692,14 @@
             imax = n
     # now make sure that the minimum and maximum contour levels computed
     # are not outside the axis limits.
-    if zaxis_min != None and zaxis_min > vc [imin] :
+    if zaxis_min is not None and zaxis_min > vc [imin] :
         for i in range (imin, imax) :
             if i + 1 < imax and zaxis_min > vc [i + 1] :
                 imin = i + 1
             else :
                 break
         vc [imin] = zaxis_min
-    if zaxis_max != None and zaxis_max < vc [imax - 1] :
+    if zaxis_max is not None and zaxis_max < vc [imax - 1] :
         for i in range (imax - imin) :
             if imax - 2 >= imin and zaxis_max < vc [imax - 2] :
                 imax = imax - 1
@@ -1709,19 +1709,19 @@
     for i in range (imin, imax) :
         [nv, xyzv, d1, nvb, xyzvb, d2] = \
            slice2x (array ( [0., 0., 1., vc [i]], Float) , nv, xyzv, None)
-        if i == imin and zaxis_min != None and zaxis_min == vc [i]:
+        if i == imin and zaxis_min is not None and zaxis_min == vc [i]:
             # Don't send the "back" surface if it's below zaxis_min.
             continue
         else:
-            if color == None :
+            if color is None :
                 pl3tree (nvb, xyzvb, (ones (len (nvb)) * colors [i]).astype ('B'),
                    split = 0, edges = edges)
             else :
                 # N. B. Force edges to be on, otherwise the graph is empty.
                 pl3tree (nvb, xyzvb, "bg", split = 0, edges = 1)
-    if zaxis_max == None or vc [imax - 1] < zaxis_max:
+    if zaxis_max is None or vc [imax - 1] < zaxis_max:
         # send "front" surface if it's not beyond zaxis_max
-        if color == None :
+        if color is None :
             pl3tree (nv, xyzv, (ones (len (nv)) * colors [i]).astype ('B'),
                split = 0, edges = edges)
         else :
@@ -1750,7 +1750,7 @@
       If CLEAR == 1, clear the display list first.
       If EDGES == 1, plot the edges.
       The algorithm is to apply slice2x repeatedly to the surface.
-      If color == None, then bytscl the palette into N + 1 colors
+      If color is None, then bytscl the palette into N + 1 colors
       and send each of the slices to pl3tree with the appropriate color.
       If color == "bg", will plot only the edges.
       If CMIN is given, use it instead of the minimum c actually
@@ -1770,13 +1770,13 @@
     # 1. Get contour colors
     if type (contours) == IntType :
         n = contours
-        if cmin != None :
+        if cmin is not None :
             vcmin = cmin
             minz = min (values)
         else :
             vcmin = min (values)
             minz = vcmin
-        if cmax != None :
+        if cmax is not None :
             vcmax = cmax
             maxz = max (values)
         else :
@@ -1828,14 +1828,14 @@
             imax = n
     # now make sure that the minimum and maximum contour levels computed
     # are not outside the axis limits.
-    if caxis_min != None and caxis_min > vc [imin] :
+    if caxis_min is not None and caxis_min > vc [imin] :
         for i in range (imin, imax) :
             if i + 1 < imax and caxis_min > vc [i + 1] :
                 imin = i + 1
             else :
                 break
         vc [imin] = caxis_min
-    if caxis_max != None and caxis_max < vc [imax - 1] :
+    if caxis_max is not None and caxis_max < vc [imax - 1] :
         for i in range (imax - imin) :
             if imax - 2 >= imin and caxis_max < vc [imax - 2] :
                 imax = imax - 1
@@ -1849,19 +1849,19 @@
             break
         [nv, xyzv, vals, nvb, xyzvb, d2] = \
            slice2x (vc [i], nv, xyzv, vals)
-        if i == imin and caxis_min != None and caxis_min == vc [i]:
+        if i == imin and caxis_min is not None and caxis_min == vc [i]:
             # Don't send the "back" surface if it's below caxis_min.
             continue
         else:
-            if color == None :
+            if color is None :
                 pl3tree (nvb, xyzvb, (ones (len (nvb)) * colors [i]).astype ('B'),
                    split = 0, edges = edges)
             else :
                 # N. B. Force edges to be on, otherwise the graph is empty.
                 pl3tree (nvb, xyzvb, "bg", split = 0, edges = 1)
-    if caxis_max == None or vc [imax - 1] < caxis_max:
+    if caxis_max is None or vc [imax - 1] < caxis_max:
         # send "front" surface if it's not beyond caxis_max
-        if color == None :
+        if color is None :
             pl3tree (nv, xyzv, (ones (len (nv)) * colors [i]).astype ('B'),
                split = 0, edges = edges)
         else :
@@ -1947,7 +1947,7 @@
         x = xyztmp [:, 0]
         y = xyztmp [:, 1]
         z = xyztmp [:, 2]
-        if values == None :
+        if values is None :
 #        xyzverts [:, 0] = x
 #        xyzverts [:, 1] = y
 #        xyzverts [:, 2] = z
@@ -1993,10 +1993,10 @@
     if shape (xyzverts) [0] != sum (nverts,axis=0) or sum (less (nverts, 3),axis=0) or \
        nverts.dtype != Int :
         raise _Pl3surfError, "illegal or inconsistent polygon list"
-    if values != None and len (values) != len (nverts) :
+    if values is not None and len (values) != len (nverts) :
         raise _Pl3surfError, "illegal or inconsistent polygon color values"
 
-    if values != None :
+    if values is not None :
         values = array (values, Float )
 
     clear3 ( )
@@ -2091,9 +2091,9 @@
     xyzverts = array (xyzverts, Float )
     if values == "background" :
         values = "bg"
-    elif values != None and values != "bg" :
+    elif values is not None and values != "bg" :
         values = array (values, values.dtype)
-    if plane != None :
+    if plane is not None :
         plane = plane.astype (Float)
 
     if shape (xyzverts) [0] != sum (nverts,axis=0) or sum (less (nverts, 3),axis=0) > 0 or \
@@ -2112,7 +2112,7 @@
         array_set (list, cumsum (nverts,axis=0) [0:-1], ones (len (nverts), Int))
         tpc = values.dtype
         values = (histogram (cumsum (list,axis=0), values) / nverts).astype (tpc)
-    if plane != None :
+    if plane is not None :
         if (len (shape (plane)) != 1 or shape (plane) [0] != 4) :
             raise _Pl3treeError, "illegal plane format, try plane3 function"
 
@@ -2595,9 +2595,9 @@
     #   back_tree= tree [1]    is the part behind plane
     #   inplane_leaf= tree [2] is the part in the plane itself
     #   front_tree= tree [3]   is the part in front of plane
-    if tree == None or tree == [] :
+    if tree is None or tree == [] :
         return None
-    if tree [0] == None or tree [0] == [] :
+    if tree [0] is None or tree [0] == [] :
         # only the leaf is non-nil (but not a plane)
         return _pl3leaf ( tree [2], 1, minmax)
 
@@ -2616,33 +2616,33 @@
         q1 = _pl3tree (tree [3], minmax)
         q2 = _pl3leaf (tree [2], 0, minmax)
         q3 = _pl3tree (tree [1], minmax)
-    if q1 != None :
-        if q2 != None and q3 == None :
+    if q1 is not None :
+        if q2 is not None and q3 is None :
             return [min (q2 [0], q1 [0]),
                     max (q2 [1], q1 [1]),
                     min (q2 [2], q1 [2]),
                     max (q2 [3], q1 [3])]
-        elif q2 == None and q3 != None :
+        elif q2 is None and q3 is not None :
             return [min (q3 [0], q1 [0]),
                     max (q3 [1], q1 [1]),
                     min (q3 [2], q1 [2]),
                     max (q3 [3], q1 [3])]
-        elif q2 != None and q3 != None :
+        elif q2 is not None and q3 is not None :
             return [min (q3 [0], q2 [0], q1 [0]),
                     max (q3 [1], q2 [1], q1 [1]),
                     min (q3 [2], q2 [2], q1 [2]),
                     max (q3 [3], q2 [3], q1 [3])]
         else :
             return q1
-    elif q2 != None :
-        if q3 == None :
+    elif q2 is not None :
+        if q3 is None :
             return q2
         else :
             return [min (q2 [0], q3 [0]),
                     max (q2 [1], q3 [1]),
                     min (q2 [2], q3 [2]),
                     max (q2 [3], q3 [3])]
-    elif q3 != None :
+    elif q3 is not None :
         return q3
     else :
         return None
@@ -2764,7 +2764,7 @@
     # when one coordinate is insignificant with
     # respect to the others and doesn't have significant digits.
     # It is awfully hard to come up with a numerical criterion for this.)
-    if item [2] == None or not_plane or has_multiple_components ():
+    if item [2] is None or not_plane or has_multiple_components ():
         minx = minmax [0]
         maxx = minmax [1]
         miny = minmax [2]
@@ -2774,7 +2774,7 @@
         _xyzverts [:, 0] = (_xyzverts [:, 0] - minx) / (maxx - minx)
         _xyzverts [:, 1] = (_xyzverts [:, 1] - miny) / (maxy - miny)
         _xyzverts [:, 2] = (_xyzverts [:, 2] - minz) / (maxz - minz)
-    if  item [2] == None :
+    if  item [2] is None :
         # this is an isosurface to be shaded (no values specified)
         _xyzverts = get3_xy (_xyzverts, 1)
         # accumulate nverts and values
@@ -2827,22 +2827,22 @@
     return [_list, _vlist, item [6]]
 
 def _pl3tree_add (leaf, plane, tree) :
-    if tree != None and tree != [] and \
-       not is_scalar (tree) and tree [0] != None :
+    if tree is not None and tree != [] and \
+       not is_scalar (tree) and tree [0] is not None :
         # tree has slicing plane, slice new leaf or plane and descend
         [back, leaf1] = _pl3tree_slice (tree [0], leaf)
         if back :
-            if len (tree) >= 2 and tree [1] != None and tree [1] != [] :
+            if len (tree) >= 2 and tree [1] is not None and tree [1] != [] :
                 _pl3tree_add (back, plane, tree [1])
             else :
                 tree [1] = [None, [], back, []]
         if (leaf1) :
-            if len (tree) >= 4 and tree [3] != None and tree [3] != [] :
+            if len (tree) >= 4 and tree [3] is not None and tree [3] != [] :
                 _pl3tree_add (leaf1, plane, tree [3])
             else :
                 tree [3] = [None, [], leaf1, []]
 
-    elif plane != None :
+    elif plane is not None :
         # tree is just a leaf, but this leaf has slicing plane
         tree [0] = plane
         tmp = tree [2]
@@ -2863,17 +2863,17 @@
     for ll in leaf :
         # each item in the leaf list is itself a list
         nvf = ll [0]
-        if nvf != None :
+        if nvf is not None :
             nvb = array (nvf, copy = 1)
         else :
             nvb = None
         xyzf = ll [1]
-        if xyzf != None :
+        if xyzf is not None :
             xyzb = array (xyzf, copy = 1)
         else :
             xyzb = None
         valf = ll [2]
-        if valf != None :
+        if valf is not None :
             tpc = valf.dtype.char
             valb = array (valf, copy = 1)
         else :
@@ -2892,17 +2892,17 @@
             ll6 = 0
         [nvf, xyzf, valf, nvb, xyzb, valb] = \
            slice2x (plane, nvf, xyzf, valf)
-        if valf != None:
+        if valf is not None:
             valf = valf.astype (tpc)
-        if valb != None:
+        if valb is not None:
             valb = valb.astype (tpc)
-        if nvf != None :
-            if frnt != None :
+        if nvf is not None :
+            if frnt is not None :
                 frnt = [ [nvf, xyzf, valf, ll [3], ll4, ll5, ll6]] + frnt
             else :
                 frnt = [ [nvf, xyzf, valf, ll [3], ll4, ll5, ll6]]
-        if nvb != None :
-            if back != None :
+        if nvb is not None :
+            if back is not None :
                 back = [ [nvb, xyzb, valb, ll [3], ll4, ll5, ll6]] + back
             else :
                 back = [ [nvb, xyzb, valb, ll [3], ll4, ll5, ll6]]
@@ -2915,7 +2915,7 @@
     _draw3_n = get_draw3_n_ ()
     if len (_draw3_list) >= _draw3_n :
         tree = _draw3_list [_draw3_n:]
-        if tree == None or tree == [] or tree [0] != pl3tree :
+        if tree is None or tree == [] or tree [0] != pl3tree :
             print "<current 3D display not a pl3tree>"
 #        raise _Pl3tree_prtError, "<current 3D display not a pl3tree>"
         else :
@@ -2923,16 +2923,16 @@
             _pl3tree_prt (tree, 0)
 
 def pl3_other_prt(tree = None):
-    if tree == None:
+    if tree is None:
         pl3tree_prt ()
     else :
-        if tree == None or tree == []:
+        if tree is None or tree == []:
             print "<current 3D display not a pl3tree>"
         else :
             _pl3tree_prt (tree, 0)
 
 def _pl3tree_prt (tree, depth) :
-    if tree == None or tree == [] :
+    if tree is None or tree == [] :
         return
     indent = (" " * (1 + 2 * depth)) [0:-1]
     print indent + "+DEPTH= " + `depth`
@@ -2942,7 +2942,7 @@
     back = tree [1]
     list = tree [2]
     frnt = tree [3]
-    if back == None or back == [] :
+    if back is None or back == [] :
         print indent + "back = []"
     else :
         _pl3tree_prt (back, depth + 1)
@@ -2954,7 +2954,7 @@
         print indent + "nverts= " + `shape (leaf [1]) [0]` + \
            ", nvals= " + `len (leaf [2])`
 
-    if frnt == None or frnt == [] :
+    if frnt is None or frnt == [] :
         print  indent + "frnt = []"
     else :
         _pl3tree_prt (frnt, depth + 1)

Modified: trunk/scipy/sparse/sparse.py
===================================================================
--- trunk/scipy/sparse/sparse.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/sparse/sparse.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -454,7 +454,7 @@
         elif axis == 1:
             # sum over rows
             return self * asmatrix(ones((n, 1), dtype=self.dtype))
-        elif axis == None:
+        elif axis is None:
             # sum over rows and columns
             return ( self * asmatrix(ones((n, 1), dtype=self.dtype)) ).sum()
         else:
@@ -818,7 +818,7 @@
         """
         # The spmatrix base class already does axis=0 and axis=1 efficiently
         # so we only do the case axis=None here
-        if axis == None:
+        if axis is None:
             return self.data[:self.indptr[-1]].sum()
         else:
             return spmatrix.sum(self,axis)

Modified: trunk/scipy/stats/stats.py
===================================================================
--- trunk/scipy/stats/stats.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/stats/stats.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -1051,7 +1051,7 @@
 Returns: (array of bin counts, bin-minimum, min-width, #-points-outside-range)
 """
     a = np.ravel(a)               # flatten any >1D arrays
-    if (defaultlimits != None):
+    if (defaultlimits is not None):
         lowerreallimit = defaultlimits[0]
         upperreallimit = defaultlimits[1]
         binsize = (upperreallimit-lowerreallimit) / float(numbins)

Modified: trunk/scipy/weave/accelerate_tools.py
===================================================================
--- trunk/scipy/weave/accelerate_tools.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/weave/accelerate_tools.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -399,7 +399,7 @@
     def function_code(self):
         code = self.wrapped_code()
         for T in self.used:
-            if T != None and T.module_init_code:
+            if T is not None and T.module_init_code:
                 self.customize.add_module_init_code(T.module_init_code)
         return code
 

Modified: trunk/scipy/weave/bytecodecompiler.py
===================================================================
--- trunk/scipy/weave/bytecodecompiler.py	2007-11-13 04:18:23 UTC (rev 3515)
+++ trunk/scipy/weave/bytecodecompiler.py	2007-11-13 04:33:01 UTC (rev 3516)
@@ -738,7 +738,7 @@
         code = self.codeobject.co_code
         bytes = len(code)
         pc = 0
-        while pc != None and pc < bytes:
+        while pc is not None and pc < bytes:
             pc = self.evaluate(pc,code)
 
         # -----------------------------------------------



More information about the Scipy-svn mailing list