From 2922c6dabbd9f8e49975ff3d972644c7212882e9 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 6 May 1994 14:28:19 +0000 Subject: Changes to use default argument values where possible --- Lib/gopherlib.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'Lib/gopherlib.py') diff --git a/Lib/gopherlib.py b/Lib/gopherlib.py index 71413bafc3b..7550d5c6071 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 -- cgit v1.2.3