Re: Interpreter output

Sjoerd Mullender (Sjoerd.Mullender@cwi.nl)
Thu, 24 Mar 1994 14:05:43 +0100

On Thu, Mar 24 1994 "Adrian Phillips (Tandem User)" wrote:

> I remember a couple of weeks ago when I had just started with python, somebod
> y
> mentioned being able to stop the interpreter from sending output to stdout (o
> r
> stderr) - the same that you would get if you were running interactive, e.g if
> you have a function that returns 1 or 0 and another calls it but doesn't chec
> k
> the response, i.e myfunc () instead of tt = myfunc(), python sends the 1/0 to
> stdout. I want to trap this in some way because it is a nightmare trying to
> find the occurrences where it does this.
> Any clues ?

You can use the -k option to python to find these occurances. The
interpreter will raise a RuntimeError when the result of an expression
would otherwise be printed.

Sjoerd Mullender, CWI, P.O. Box 94079, 1090 GB Amsterdam, The Netherlands
E-Mail: Sjoerd.Mullender@cwi.nl; Phone: +31 20 592 4127; Fax: +31 20 592 4199
URL: <http://www.cwi.nl/cwi/people/Sjoerd.Mullender.html>