diff options
| author | rakiru <rabbitkillrun@googlemail.com> | 2018-01-11 19:19:58 +0000 |
|---|---|---|
| committer | rakiru <rabbitkillrun@googlemail.com> | 2018-01-11 19:19:58 +0000 |
| commit | 6f0e48eac4f20894c802c93ac75cfa4693fbaa36 (patch) | |
| tree | 9c32ae6716393d3aa7ccbb14a41494efe34d2399 | |
| parent | e0164e21209cec0ec24e9d25eee90711bca78947 (diff) | |
Replace None equality checks with identity checks
Both work, but the identity check is the more correct/idiomatic
approach (and also ever-so-slightly more efficient).
| -rw-r--r-- | asciifarm/client/display/fieldpad.py | 6 | ||||
| -rwxr-xr-x | asciifarm/client/main.py | 2 | ||||
| -rw-r--r-- | asciifarm/common/utils.py | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/asciifarm/client/display/fieldpad.py b/asciifarm/client/display/fieldpad.py index 6619c1f..f64634e 100644 --- a/asciifarm/client/display/fieldpad.py +++ b/asciifarm/client/display/fieldpad.py @@ -29,14 +29,14 @@ class FieldPad: def changeCell(self, x, y, sprites): """ sprites must always have at least one element """ char, colour, bgcolour = sprites[0] - if bgcolour == None: + if bgcolour is None: for (ch, co, bg) in sprites: - if bg != None: + if bg is not None: bgcolour = bg break else: bgcolour = 0 - if colour != None and self.colours: + if colour is not None and self.colours: self.pad.addstr(y, x*self.charSize, char, self.colours.get(colour, bgcolour)) else: self.pad.addstr(y, x*self.charSize, char) diff --git a/asciifarm/client/main.py b/asciifarm/client/main.py index de77d09..48e89ad 100755 --- a/asciifarm/client/main.py +++ b/asciifarm/client/main.py @@ -57,7 +57,7 @@ def main(argv=None): keybindings = kf.read() address = args.address - if address == None: + if address is None: address = defaultAdresses[args.socket] if args.socket == "abstract": address = '\0' + address diff --git a/asciifarm/common/utils.py b/asciifarm/common/utils.py index cdc8dd5..95ac32b 100644 --- a/asciifarm/common/utils.py +++ b/asciifarm/common/utils.py @@ -27,7 +27,7 @@ def concat(arr): def writeFileSafe(filename, data, tempname=None): - if tempname == None: + if tempname is None: tempname = filename + ".tempfile" with open(tempname, 'w') as f: f.write(data) |
