Commit 9c38d980 authored by Jason Swails's avatar Jason Swails
Browse files

Stop using "== None" and "!= None". "is" and "is not" is the preferred way to do

it.  Not only that, I got this FutureWarning:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/simtk/unit/quantity.py:170:
FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  if value == None:
parent 8faeeb4d
......@@ -625,9 +625,9 @@ Examples
>>> 1.2*meters < 72*centimeters
False
>>> meter != None
>>> meter is not None
True
>>> meter == None
>>> meter is None
False
Examples
......
......@@ -60,7 +60,7 @@ def zeros(m, n=None):
[0, 0, 0]
[0, 0, 0]]
"""
if n == None:
if n is None:
n = m
result = []
for row in range(0, m):
......
......@@ -114,7 +114,7 @@ class Quantity(object):
- unit: (Unit) the physical unit, e.g. simtk.unit.meters.
"""
# When no unit is specified, bend over backwards to handle all one-argument possibilities
if unit == None: # one argument version, copied from UList
if unit is None: # one argument version, copied from UList
if is_unit(value):
# Unit argument creates an empty list with that unit attached
unit = value
......@@ -167,7 +167,7 @@ class Quantity(object):
value = value * unit._value
unit = unit.unit
# Use empty list for unspecified values
if value == None:
if value is None:
value = []
self._value = value
......@@ -306,7 +306,7 @@ class Quantity(object):
value_factor = 1.0
canonical_units = {} # dict of dimensionTuple: (Base/ScaledUnit, exponent)
# Bias result toward guide units
if guide_unit != None:
if guide_unit is not None:
for u, exponent in guide_unit.iter_base_or_scaled_units():
d = u.get_dimension_tuple()
if d not in canonical_units:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment