diff options
author | Raymond Hettinger <python@rcn.com> | 2002-06-02 00:40:05 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2002-06-02 00:40:05 (GMT) |
commit | f13eb55d59d80907c9f86574ddd23bce2cb41ff3 (patch) | |
tree | 799ffe8a95c5cacd946f186f3022f380b418141d | |
parent | 1931ca72b5769ee686776617e2d97d839cc7d2d6 (diff) | |
download | cpython-f13eb55d59d80907c9f86574ddd23bce2cb41ff3.zip cpython-f13eb55d59d80907c9f86574ddd23bce2cb41ff3.tar.gz cpython-f13eb55d59d80907c9f86574ddd23bce2cb41ff3.tar.bz2 |
Replace boolean test with is None.
-rw-r--r-- | Lib/sgmllib.py | 2 | ||||
-rw-r--r-- | Lib/shlex.py | 8 | ||||
-rw-r--r-- | Lib/shutil.py | 2 | ||||
-rwxr-xr-x | Lib/smtplib.py | 2 | ||||
-rw-r--r-- | Lib/sre_compile.py | 2 | ||||
-rw-r--r-- | Lib/sre_parse.py | 4 |
6 files changed, 10 insertions, 10 deletions
diff --git a/Lib/sgmllib.py b/Lib/sgmllib.py index bdca8a6..021c8b5 100644 --- a/Lib/sgmllib.py +++ b/Lib/sgmllib.py @@ -479,7 +479,7 @@ class TestSGMLParser(SGMLParser): def test(args = None): import sys - if not args: + if args is None: args = sys.argv[1:] if args and args[0] == '-s': diff --git a/Lib/shlex.py b/Lib/shlex.py index e50b9ad..7ffa79c 100644 --- a/Lib/shlex.py +++ b/Lib/shlex.py @@ -12,7 +12,7 @@ __all__ = ["shlex"] class shlex: "A lexical analyzer class for simple shell-like syntaxes." def __init__(self, instream=None, infile=None): - if instream: + if instream is not None: self.instream = instream self.infile = infile else: @@ -47,7 +47,7 @@ class shlex: self.instream = newstream self.lineno = 1 if self.debug: - if newfile: + if newfile is not None: print 'shlex: pushing to file %s' % (self.infile,) else: print 'shlex: pushing to stream %s' % (self.instream,) @@ -188,9 +188,9 @@ class shlex: def error_leader(self, infile=None, lineno=None): "Emit a C-compiler-like, Emacs-friendly error-message leader." - if not infile: + if infile is None: infile = self.infile - if not lineno: + if lineno is None: lineno = self.lineno return "\"%s\", line %d: " % (infile, lineno) diff --git a/Lib/shutil.py b/Lib/shutil.py index 6e3a276..4340127 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -122,7 +122,7 @@ def rmtree(path, ignore_errors=0, onerror=None): exc = sys.exc_info() if ignore_errors: pass - elif onerror: + elif onerror is not None: onerror(cmd[0], cmd[1], exc) else: raise exc[0], (exc[1][0], exc[1][1] + ' removing '+cmd[1]) diff --git a/Lib/smtplib.py b/Lib/smtplib.py index 62b19bd..4311d1a 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -236,7 +236,7 @@ class SMTP: (code, msg) = self.connect(host, port) if code != 220: raise SMTPConnectError(code, msg) - if local_hostname: + if local_hostname is not None: self.local_hostname = local_hostname else: # RFC 2821 says we should use the fqdn in the EHLO/HELO verb, and diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py index e48be72..1c54f67 100644 --- a/Lib/sre_compile.py +++ b/Lib/sre_compile.py @@ -145,7 +145,7 @@ def _compile(code, pattern, flags): def _compile_charset(charset, flags, code, fixup=None): # compile charset subprogram emit = code.append - if not fixup: + if fixup is None: fixup = lambda x: x for op, av in _optimize_charset(charset, fixup): emit(OPCODES[op]) diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index a5a8831..1b52967 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -80,7 +80,7 @@ class Pattern: def opengroup(self, name=None): gid = self.groups self.groups = gid + 1 - if name: + if name is not None: ogid = self.groupdict.get(name, None) if ogid is not None: raise error, ("redefinition of group name %s as group %d; " @@ -97,7 +97,7 @@ class SubPattern: # a subpattern, in intermediate form def __init__(self, pattern, data=None): self.pattern = pattern - if not data: + if data is None: data = [] self.data = data self.width = None |