diff options
author | Guido van Rossum <guido@python.org> | 1994-05-06 14:28:19 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-05-06 14:28:19 (GMT) |
commit | 2922c6dabbd9f8e49975ff3d972644c7212882e9 (patch) | |
tree | 3ea84b9ee77599005eee665078cb486deb7209e6 /Lib/gopherlib.py | |
parent | e4c6131baab4d09d31d280fa7dbca76cbe319dbb (diff) | |
download | cpython-2922c6dabbd9f8e49975ff3d972644c7212882e9.zip cpython-2922c6dabbd9f8e49975ff3d972644c7212882e9.tar.gz cpython-2922c6dabbd9f8e49975ff3d972644c7212882e9.tar.bz2 |
Changes to use default argument values where possible
Diffstat (limited to 'Lib/gopherlib.py')
-rw-r--r-- | Lib/gopherlib.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Lib/gopherlib.py b/Lib/gopherlib.py index 71413ba..7550d5c 100644 --- a/Lib/gopherlib.py +++ b/Lib/gopherlib.py @@ -54,14 +54,10 @@ CRLF = '\r\n' TAB = '\t' # Send a selector to a given host and port, return a file with the reply -def send_selector(selector, host, *args): +def send_selector(selector, host, port = 0): import socket import string - if args: - if args[1:]: raise TypeError, 'too many args' - port = args[0] - else: - port = None + if not port: i = string.find(host, ':') if i >= 0: host, port = host[:i], string.atoi(host[i+1:]) @@ -76,8 +72,8 @@ def send_selector(selector, host, *args): return s.makefile('r') # Send a selector and a query string -def send_query(selector, query, host, *args): - return apply(send_selector, (selector + '\t' + query, host) + args) +def send_query(selector, query, host, port = 0): + return send_selector(selector + '\t' + query, host, port) # The following functions interpret the data returned by the gopher # server according to the expected type, e.g. textfile or directory |