Printing of individually returned values when running interactively

Hrvoje Niksic hniksic at iskon.hr
Tue Nov 2 16:41:03 CET 1999


I've just noticed (the hard way) a very unusual feature of Python's
interactive interpreter mode.  If you evaluate several values on
several lines, all the values are printed!  For instance:

>>> if 1:
...  1
...  2
...  3
... 
1
2
3

My remark will probably look strange to seasoned Pythoneers, but I'm
really surprised by discovering this.  Why would anyone want a thing
like that?  Doesn't it produce loads of debug-like output when pasting
more complex things?

I guess I'm more used to Lisp interactive interpreters whose REPL is
sexp-oriented, and prints the value of the last read sexp.


(If you're curious, the case that hit me hard was when I tested
mxODBC's connection with a remote database at work.  I wrote something
like:

for i in range(10000):
  cur.execute('insert into test ...', i)

Needless to mention, the execute() method returns a number!)




More information about the Python-list mailing list