Skip to content

Commit

Permalink
Don't use mutable defaults as args for methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sivel committed Nov 11, 2016
1 parent 6685d91 commit c512684
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions speedtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,10 +779,13 @@ def get_config(self):

return self.config

def get_servers(self, servers=[]):
def get_servers(self, servers=None):
"""Retrieve a the list of speedtest.net servers, optionally filtered
to servers matching those specified in the ``servers`` argument
"""
if servers is None:
servers = []

self.servers.clear()

for i, s in enumerate(servers):
Expand Down Expand Up @@ -951,7 +954,7 @@ def get_closest_servers(self, limit=5):
printer(self.closest, debug=True)
return self.closest

def get_best_server(self, servers=[]):
def get_best_server(self, servers=None):
"""Perform a speedtest.net "ping" to determine which speedtest.net
server has the lowest latency
"""
Expand Down

0 comments on commit c512684

Please sign in to comment.