summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-06-01 16:07:16 +0000
committerRaymond Hettinger <python@rcn.com>2002-06-01 16:07:16 +0000
commite3a032af65863e1dcfa567e5bd597206852285fa (patch)
tree690c936621f521b9952c15d6e820256771d2cca1
parentb107b91918709688044030d2e2a50a10d9450580 (diff)
downloadcpython-e3a032af65863e1dcfa567e5bd597206852285fa.tar.gz
Replace boolean test with is None.
-rw-r--r--Lib/mhlib.py10
-rw-r--r--Lib/netrc.py2
-rw-r--r--Lib/poplib.py4
-rw-r--r--Lib/pprint.py2
-rwxr-xr-xLib/profile.py2
-rw-r--r--Lib/pstats.py2
-rw-r--r--Lib/py_compile.py2
7 files changed, 12 insertions, 12 deletions
diff --git a/Lib/mhlib.py b/Lib/mhlib.py
index d4869c6236..912f0015b7 100644
--- a/Lib/mhlib.py
+++ b/Lib/mhlib.py
@@ -98,9 +98,9 @@ class MH:
def __init__(self, path = None, profile = None):
"""Constructor."""
- if not profile: profile = MH_PROFILE
+ if profile is None: profile = MH_PROFILE
self.profile = os.path.expanduser(profile)
- if not path: path = self.getprofile('Path')
+ if path is None: path = self.getprofile('Path')
if not path: path = PATH
if not os.path.isabs(path) and path[0] != '~':
path = os.path.join('~', path)
@@ -665,7 +665,7 @@ class Message(mimetools.Message):
"""Constructor."""
self.folder = f
self.number = n
- if not fp:
+ if fp is None:
path = f.getmessagefilename(n)
fp = open(path, 'r')
mimetools.Message.__init__(self, fp)
@@ -679,7 +679,7 @@ class Message(mimetools.Message):
argument is specified, it is used as a filter predicate to
decide which headers to return (its argument is the header
name converted to lower case)."""
- if not pred:
+ if pred is None:
return ''.join(self.headers)
headers = []
hit = 0
@@ -791,7 +791,7 @@ class IntSet:
self.pairs = []
self.sep = sep
self.rng = rng
- if data: self.fromstring(data)
+ if data is not None: self.fromstring(data)
def reset(self):
self.pairs = []
diff --git a/Lib/netrc.py b/Lib/netrc.py
index 9ce7efb060..316a66c886 100644
--- a/Lib/netrc.py
+++ b/Lib/netrc.py
@@ -21,7 +21,7 @@ class NetrcParseError(Exception):
class netrc:
def __init__(self, file=None):
- if not file:
+ if file is None:
try:
file = os.path.join(os.environ['HOME'], ".netrc")
except KeyError:
diff --git a/Lib/poplib.py b/Lib/poplib.py
index 052504302e..0b22b2e4ef 100644
--- a/Lib/poplib.py
+++ b/Lib/poplib.py
@@ -220,7 +220,7 @@ class POP3:
Result when a message number argument is given is a
single response: the "scan listing" for that message.
"""
- if which:
+ if which is not None:
return self._shortcmd('LIST %s' % which)
return self._longcmd('LIST')
@@ -313,7 +313,7 @@ class POP3:
in the form 'response mesgnum uid', otherwise result is
the list ['response', ['mesgnum uid', ...], octets]
"""
- if which:
+ if which is not None:
return self._shortcmd('UIDL %s' % which)
return self._longcmd('UIDL')
diff --git a/Lib/pprint.py b/Lib/pprint.py
index 1c1159315f..523572ba89 100644
--- a/Lib/pprint.py
+++ b/Lib/pprint.py
@@ -101,7 +101,7 @@ class PrettyPrinter:
self.__depth = depth
self.__indent_per_level = indent
self.__width = width
- if stream:
+ if stream is not None:
self.__stream = stream
else:
self.__stream = sys.stdout
diff --git a/Lib/profile.py b/Lib/profile.py
index fa3527f03f..c1001f9005 100755
--- a/Lib/profile.py
+++ b/Lib/profile.py
@@ -150,7 +150,7 @@ class Profile:
bias = self.bias
self.bias = bias # Materialize in local dict for lookup speed.
- if not timer:
+ if timer is None:
if os.name == 'mac':
self.timer = MacOS.GetTicks
self.dispatcher = self.trace_dispatch_mac
diff --git a/Lib/pstats.py b/Lib/pstats.py
index 126d0beec6..c5d8c3899f 100644
--- a/Lib/pstats.py
+++ b/Lib/pstats.py
@@ -506,7 +506,7 @@ if __name__ == '__main__':
def __init__(self, profile=None):
cmd.Cmd.__init__(self)
self.prompt = "% "
- if profile:
+ if profile is not None:
self.stats = Stats(profile)
else:
self.stats = None
diff --git a/Lib/py_compile.py b/Lib/py_compile.py
index afeaae12c6..ce67584991 100644
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -67,7 +67,7 @@ def compile(file, cfile=None, dfile=None):
sys.stderr.write(line.replace('File "<string>"',
'File "%s"' % (dfile or file)))
return
- if not cfile:
+ if cfile is None:
cfile = file + (__debug__ and 'c' or 'o')
fc = open(cfile, 'wb')
fc.write('\0\0\0\0')