]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
*** empty log message ***
authorGuido van Rossum <guido@python.org>
Fri, 17 Dec 1993 14:39:12 +0000 (14:39 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 17 Dec 1993 14:39:12 +0000 (14:39 +0000)
Demo/sockets/gopher.py
Demo/sockets/radio.py
Demo/stdwin/jukebox.py
Demo/stdwin/lpwin.py
Demo/stdwin/python.py

index 625697b5e735c193dfcef1674c17371b5acac4bf..f30ab0f1c8eb1930ac3969b6e83e2d1a3c31f0a3 100755 (executable)
@@ -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()
index 4bb55ff9951e3c6f71d71da206cf64f5bd7037d0..5905ff2a3cf3fe35473f4e7cdc1053a2fece5770 100755 (executable)
@@ -9,5 +9,6 @@ s = socket(AF_INET, SOCK_DGRAM)
 s.bind('', MYPORT)
 
 while 1:
-       data = s.recv(1500)
+       data, wherefrom = s.recvfrom(1500, 0)
+       sys.stderr.write(`wherefrom` + '\n')
        sys.stdout.write(data)
index ff520dbca0e4a9182b7a7de39b22c6c5a6f5d64e..bc43cb5ae558d56312f1fd5388f4889e1231d87f 100755 (executable)
@@ -45,7 +45,7 @@ SFPLAY = '/usr/sbin/sfplay'           # Sound playing program
 
 # Global variables
 
-class struct(): pass           # Class to define featureless structures
+class struct: pass             # Class to define featureless structures
 
 G = struct()                   # oHlds writable global variables
 
index 0a1346f4d1eec317d5b117999848e4851a75437b..eaf98bea342a07f4709ea3d938f4543133e2a9fa 100755 (executable)
@@ -86,7 +86,8 @@ def main():
        mainloop.register(win)
        mainloop.mainloop()
 
-def lpdispatch(type, win, detail):
+def lpdispatch(event):
+       type, win, detail = event
        if type == WE_CLOSE or type == WE_CHAR and detail in ('q', 'Q'):
                mainloop.unregister(win)
        elif type == WE_DRAW:
index ce398aa3e99748ecfbb15dbab390431713fcf01d..2506078630e1b1774131b1faedd548d8ca14c786 100755 (executable)
@@ -375,7 +375,7 @@ def do_exec(win):
        save_stdout = sys.stdout
        save_stderr = sys.stderr
        try:
-               sys.stdin = sys.stdout = sys.stderr = IOWindow().init(win)
+               sys.stdin = sys.stdout = sys.stderr = IOWindow(win)
                win.busy = 1
                try:
                        exec(command, win.globals)
@@ -404,9 +404,8 @@ def do_exec(win):
 #
 class IOWindow:
        #
-       def init(self, win):
+       def __init__(self, win):
                self.win = win
-               return self
        #
        def readline(self, *unused_args):
                n = len(inputwindows)