From e50ef32ae616ef2891f495b706dfc872cce948e8 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Sat, 26 Sep 2009 00:06:43 -0400 Subject: [PATCH] remove stray period --- files.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files.html b/files.html index caf7fa2..4619159 100644 --- a/files.html +++ b/files.html @@ -363,7 +363,7 @@ AttributeError: '_io.BufferedReader' object has no attribute 'encoding'Streams Objects From Non-File Sources -

Imagine you’re writing a library, and one of your library functions is going to read some data from a file. The function could simply take a filename as a string, go open the file for reading, read it, and close it before exiting. But you shouldn’t do that.. Instead, your API should take an arbitrary stream object. +

Imagine you’re writing a library, and one of your library functions is going to read some data from a file. The function could simply take a filename as a string, go open the file for reading, read it, and close it before exiting. But you shouldn’t do that. Instead, your API should take an arbitrary stream object.

In the simplest case, a stream object is anything with a read() method which takes an optional size parameter and returns a string. When called with no size parameter, the read() method should read everything there is to read from the input source and return all the data as a single value. When called with a size parameter, it reads that much from the input source and returns that much data. When called again, it picks up where it left off and returns the next chunk of data.