Skip to content

Commit aeb2b4c

Browse files
committed
Check self.port is None first for readability
1 parent 7e113ba commit aeb2b4c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/http/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -917,10 +917,10 @@ def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
917917
self._create_connection = socket.create_connection
918918

919919
def __repr__(self):
920-
if self.port is not None:
921-
port = self.port
922-
else:
920+
if self.port is None:
923921
port = self.default_port
922+
else:
923+
port = self.port
924924
return f'<{self.__class__.__name__} {self.host}:{port}>'
925925

926926
def set_tunnel(self, host, port=None, headers=None):

0 commit comments

Comments
 (0)