From 094662a16542d1cc56713b35dde39089490dec35 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sat, 1 Jun 2002 01:29:16 +0000 Subject: Replace boolean test with is None --- Lib/formatter.py | 4 ++-- Lib/ftplib.py | 2 +- Lib/gettext.py | 2 +- Lib/hmac.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/formatter.py b/Lib/formatter.py index 75f4718..ccbbdf1 100644 --- a/Lib/formatter.py +++ b/Lib/formatter.py @@ -38,7 +38,7 @@ class NullFormatter: """ def __init__(self, writer=None): - if not writer: + if writer is None: writer = NullWriter() self.writer = writer def end_paragraph(self, blankline): pass @@ -433,7 +433,7 @@ class DumbWriter(NullWriter): def test(file = None): w = DumbWriter() f = AbstractFormatter(w) - if file: + if file is not None: fp = open(file) elif sys.argv[1:]: fp = open(sys.argv[1]) diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 21b9e52..4a3d884 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -659,7 +659,7 @@ class Netrc: __defacct = None def __init__(self, filename=None): - if not filename: + if filename is None: if os.environ.has_key("HOME"): filename = os.path.join(os.environ["HOME"], ".netrc") diff --git a/Lib/gettext.py b/Lib/gettext.py index 0bea9ed..253b6d8 100644 --- a/Lib/gettext.py +++ b/Lib/gettext.py @@ -104,7 +104,7 @@ class NullTranslations: self._info = {} self._charset = None self._fallback = None - if fp: + if fp is not None: self._parse(fp) def _parse(self, fp): diff --git a/Lib/hmac.py b/Lib/hmac.py index c9e4ae8..ba0a63c 100644 --- a/Lib/hmac.py +++ b/Lib/hmac.py @@ -46,7 +46,7 @@ class HMAC: key = key + chr(0) * (blocksize - len(key)) self.outer.update(_strxor(key, opad)) self.inner.update(_strxor(key, ipad)) - if (msg): + if msg is not None: self.update(msg) ## def clear(self): -- cgit v0.12