summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-12-17 14:39:12 (GMT)
committerGuido van Rossum <guido@python.org>1993-12-17 14:39:12 (GMT)
commitd55f4d1a7665aaeeba85c64671350fe408bc5bb2 (patch)
treeefd6243b750e9ef6f840f04182489542e248aa50
parent9e80d6f12512803532aed39a0335e6346b77abf4 (diff)
downloadcpython-d55f4d1a7665aaeeba85c64671350fe408bc5bb2.zip
cpython-d55f4d1a7665aaeeba85c64671350fe408bc5bb2.tar.gz
cpython-d55f4d1a7665aaeeba85c64671350fe408bc5bb2.tar.bz2
*** empty log message ***
-rwxr-xr-xDemo/sockets/gopher.py12
-rwxr-xr-xDemo/sockets/radio.py3
-rwxr-xr-xDemo/stdwin/jukebox.py2
-rwxr-xr-xDemo/stdwin/lpwin.py3
-rwxr-xr-xDemo/stdwin/python.py5
5 files changed, 12 insertions, 13 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()
diff --git a/Demo/sockets/radio.py b/Demo/sockets/radio.py
index 4bb55ff..5905ff2 100755
--- a/Demo/sockets/radio.py
+++ b/Demo/sockets/radio.py
@@ -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)
diff --git a/Demo/stdwin/jukebox.py b/Demo/stdwin/jukebox.py
index ff520db..bc43cb5 100755
--- a/Demo/stdwin/jukebox.py
+++ b/Demo/stdwin/jukebox.py
@@ -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
diff --git a/Demo/stdwin/lpwin.py b/Demo/stdwin/lpwin.py
index 0a1346f..eaf98be 100755
--- a/Demo/stdwin/lpwin.py
+++ b/Demo/stdwin/lpwin.py
@@ -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:
diff --git a/Demo/stdwin/python.py b/Demo/stdwin/python.py
index ce398aa..2506078 100755
--- a/Demo/stdwin/python.py
+++ b/Demo/stdwin/python.py
@@ -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)