Hmmm, Beazley book missing something?

Steve Lamb grey at despair.rpglink.com
Tue Aug 1 16:39:56 EDT 2000


    Ok, trying to get a basic read loop going for stdin in Python.  If I may
explain in perl.

while (<>){
  do_meaningful_crap_here();
}

    Look up stdin in the Beazley book and note that it has a basic routine for
reading stdin character by character.  That can't be right.  So I check dir()
on sys and then sys.stdin

>>> dir(sys.stdin)
['close', 'closed', 'fileno', 'flush', 'isatty', 'mode', 'name', 'read',
'readinto', 'readline', 'readlines', 'seek', 'softspace', 'tell',
'truncate', 'write', 'writelines']

    I see readline and readlines in there.  Only mention of it is in the
multifile object.  No __doc__ string for those methods, either.  Did this get
overlooked in this book?

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------



More information about the Python-list mailing list