From 0cdf3daa783bcbf085b476dbecaa570ee9daf6b0 Mon Sep 17 00:00:00 2001 From: Matt Bernier Date: Mon, 29 Feb 2016 22:10:33 -0700 Subject: [PATCH] Small optimization move all the repeated reset code into the reset method. The only question I had was whether there are repercussions to having self._response_body = None self._response_headers = None In the _reset() method. --- python_http_client/client.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/python_http_client/client.py b/python_http_client/client.py index bde0714..3274990 100644 --- a/python_http_client/client.py +++ b/python_http_client/client.py @@ -35,18 +35,16 @@ def __init__(self, # These are the supported HTTP verbs self.methods = ['delete', 'get', 'patch', 'post', 'put'] self._version = version - # _count and _url_path keep track of the dynamically built url - self._count = 0 - self._url_path = {} - self._status_code = None - self._response_body = None - self._response_headers = None - self._response = None + self._reset(self) def _reset(self): """Resets the URL builder, so you can make a fresh new dynamic call.""" + # _count and _url_path keep track of the dynamically built url self._count = 0 self._url_path = {} + self._status_code = None + self._response_body = None + self._response_headers = None self._response = None def _add_to_url_path(self, name):