Use built-in file.read() instead of util.readfile().

This commit is contained in:
Guido van Rossum 1991-04-21 19:31:39 +00:00
parent 001fa6a20f
commit 40b0f3aa0e
2 changed files with 10 additions and 6 deletions

View File

@ -2,17 +2,19 @@
# File windows, a subclass of textwin (which is a subclass of gwin) # File windows, a subclass of textwin (which is a subclass of gwin)
import textwin import textwin
from util import readfile import builtin
# FILE WINDOW # FILE WINDOW
def open_readonly(fn): # Open a file window def open_readonly(fn): # Open a file window
w = textwin.open_readonly(fn, readfile(fn)) fp = builtin.open(fn, 'r')
w = textwin.open_readonly(fn, fp.read())
w.fn = fn w.fn = fn
return w return w
def open(fn): # Open a file window def open(fn): # Open a file window
w = textwin.open(fn, readfile(fn)) fp = builtin.open(fn, 'r')
w = textwin.open(fn, fp.read())
w.fn = fn w.fn = fn
return w return w

View File

@ -2,17 +2,19 @@
# File windows, a subclass of textwin (which is a subclass of gwin) # File windows, a subclass of textwin (which is a subclass of gwin)
import textwin import textwin
from util import readfile import builtin
# FILE WINDOW # FILE WINDOW
def open_readonly(fn): # Open a file window def open_readonly(fn): # Open a file window
w = textwin.open_readonly(fn, readfile(fn)) fp = builtin.open(fn, 'r')
w = textwin.open_readonly(fn, fp.read())
w.fn = fn w.fn = fn
return w return w
def open(fn): # Open a file window def open(fn): # Open a file window
w = textwin.open(fn, readfile(fn)) fp = builtin.open(fn, 'r')
w = textwin.open(fn, fp.read())
w.fn = fn w.fn = fn
return w return w