Skip to content

Commit 1ed6857

Browse files
committed
Don't use is operator for equality
It could do the wrong thing in some implementations of Python.
1 parent e875325 commit 1ed6857

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pyPostcode/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, id, message):
3030
class Api(object):
3131

3232
def __init__(self, api_key, api_version=(3, 0, 0)):
33-
if api_key is None or api_key is '':
33+
if not api_key:
3434
raise pyPostcodeException(
3535
0, "Please request an api key on http://postcodeapi.nu")
3636

@@ -67,7 +67,7 @@ def request(self, path=None):
6767
self.url + path, headers=headers,
6868
))
6969

70-
if result.getcode() is not 200:
70+
if result.getcode() != 200:
7171
self.handleresponseerror(result.getcode())
7272

7373
resultdata = result.read()

0 commit comments

Comments
 (0)