diff options
author | Guido van Rossum <guido@python.org> | 1993-12-17 14:39:12 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-12-17 14:39:12 (GMT) |
commit | d55f4d1a7665aaeeba85c64671350fe408bc5bb2 (patch) | |
tree | efd6243b750e9ef6f840f04182489542e248aa50 /Demo/sockets/gopher.py | |
parent | 9e80d6f12512803532aed39a0335e6346b77abf4 (diff) | |
download | cpython-d55f4d1a7665aaeeba85c64671350fe408bc5bb2.zip cpython-d55f4d1a7665aaeeba85c64671350fe408bc5bb2.tar.gz cpython-d55f4d1a7665aaeeba85c64671350fe408bc5bb2.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'Demo/sockets/gopher.py')
-rwxr-xr-x | Demo/sockets/gopher.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Demo/sockets/gopher.py b/Demo/sockets/gopher.py index 625697b..f30ab0f 100755 --- a/Demo/sockets/gopher.py +++ b/Demo/sockets/gopher.py @@ -200,7 +200,7 @@ def browse_textfile(selector, host, port): x = None try: p = os.popen('${PAGER-more}', 'w') - x = SaveLines().init(p) + x = SaveLines(p) get_alt_textfile(selector, host, port, x.writeln) except IOError, msg: print 'IOError:', msg @@ -209,7 +209,7 @@ def browse_textfile(selector, host, port): f = open_savefile() if not f: return - x = SaveLines().init(f) + x = SaveLines(f) try: get_alt_textfile(selector, host, port, x.writeln) print 'Done.' @@ -252,7 +252,7 @@ def browse_binary(selector, host, port): f = open_savefile() if not f: return - x = SaveWithProgress().init(f) + x = SaveWithProgress(f) get_alt_binary(selector, host, port, x.write, 8*1024) x.close() @@ -268,9 +268,8 @@ typebrowser = {'0': browse_textfile, '1': browse_menu, \ # Class used to save lines, appending a newline to each line class SaveLines: - def init(self, f): + def __init__(self, f): self.f = f - return self def writeln(self, line): self.f.write(line + '\n') def close(self): @@ -280,9 +279,8 @@ class SaveLines: # Class used to save data while showing progress class SaveWithProgress: - def init(self, f): + def __init__(self, f): self.f = f - return self def write(self, data): sys.stdout.write('#') sys.stdout.flush() |