From 6f0e48eac4f20894c802c93ac75cfa4693fbaa36 Mon Sep 17 00:00:00 2001 From: rakiru Date: Thu, 11 Jan 2018 19:19:58 +0000 Subject: 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). --- asciifarm/client/display/fieldpad.py | 6 +++--- asciifarm/client/main.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'asciifarm/client') 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 -- cgit