Re: A useful quickie function to read data.

Guido van Rossum (Guido.van.Rossum@cwi.nl)
Fri, 06 Dec 91 11:43:41 +0100

>Also note: sys.exc_type not in the library reference. I found it with
> dir(sys). Several times I have been ready to write a "why doesn't
> python have" or "why can't you" message, only to find, with a little
> poking around that what I needed *was* there somewhere.

Scanning the table-of-contents of the library reference manual is always a
good way to start. One day I'll prepare a full-blown index... (But first
the reference manual must be completed.)

># but 'input' seems to only work on one liners,

Actually, input() directly calls the lexical scanner, and accepts a
backslash to indicate continuation lines.

># >>> a = 1
># >>> b = input( '?:' )
># ?: a
># Fails: a is not defined within the scope of input()
># unless you also pass a symbol table. )

This example assigns 1 to b if I try it. The default environment where
input() and eval()/exec() work is that where the call is.

--Guido van Rossum, CWI, Amsterdam <guido@cwi.nl>
"It's probably pining for the fiords"