Hmmm, Beazley book missing something?

Sean Blakey sblakey at freei.com
Tue Aug 1 20:42:12 EDT 2000


On Tue, Aug 01, 2000 at 11:39:34PM +0000, Steve Lamb wrote:
> On 01 Aug 2000 17:42:00 -0400, David Bolen <db3l at fitlinxx.com> wrote:
> >sys.stdin is just an instance of a built-in file object type, from
> >which it inherits its methods.  I don't have my copy of the Essential
> >book in front of me, but there's probably a discussion of these
> >methods around the sections of other built in object types.
> 
>     Saw that and went looking for references to it.  Nope.  That is why I went
> to the index and looked for all instances of readline(s).
> 
> -- 
>          Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
>          ICQ: 5107343          | main connection to the switchboard of souls.
> -------------------------------+---------------------------------------------
> -- 
> http://www.python.org/mailman/listinfo/python-list

I really think the documentation in the Beazley book is reasonable

>From the table of contents:
3 Types and Objects  17
  Built-in Types  20
    Files  26
9 Input and Output  77
  Files  78
  Standard Input, Output, and Error  79

>From the Index:
file types: 20, 26
stdin: 79

>From page 26:
Files:
    The file object represents an open file and is returned by the built
    in open() function (as well as a number of functions in the standard
    library).  For more details on this type, see Chapter 9, "Input and
    Output."

>From Table 9.1 on page 78 (the second page of chapter 9:
Method              Description
-------------------------------
f.readline()        Reads a single line of input
f.readlines()       Reads all the lines and returns a list

Also notice that Table 9.1 is directly across from the discussion on
"Standard Input, Output, and Error" on page 79 (the only page referenced
for "stdin" in the index.

>From page 79:
The interpreter provides three standard file objects, known as standard
input, standard output, and standard error, which are available in the
sys module as sys.stdin, sys.stdout, and sys.stderr, respectively.

>From page 102 (documenting the sys module):
------------------------------------------------------
stdin,              File objects corresponding to standard input, 
stdout,             standard output, and standard error.  stdin is used 
stderr              for the raw_input() and input() functions.  stdout

Perhaps I'm jaded by over-familiarity with this book, but it seems that
any reasonable search would have turned up this information.  True, the
example on page 79 does only show the read() method of sys.stdin, but
sys.stdin is clearly described as a "file object", and all the
properties of a "file object" are described in the immediately preceding
section (on the opposite page).
    -Sean

-- 
Sean Blakey, sblakey at freei.com
Software Developer, FreeInternet.com
(253)796-6500x1025
"Never ascribe to malice that which is caused by greed and ignorance."
-- Cal Keegan




More information about the Python-list mailing list