gettext and the interpreter

  • Thread starter Hans-Joachim Widmaier
  • Start date
H

Hans-Joachim Widmaier

Recently I wanted to do some debugging using one module of my first
Python program using the gettext module. I just didn't find a way to
disable the interpreter binding the last result to _, which ought to
be (and stay) a function.

Anybody got an idea how to do it?

Hans-Joachim
 
P

Peter Otten

Hans-Joachim Widmaier said:
Recently I wanted to do some debugging using one module of my first
Python program using the gettext module. I just didn't find a way to
disable the interpreter binding the last result to _, which ought to
be (and stay) a function.

Anybody got an idea how to do it?

Try redefining sys.displayhook, e. g.:
.... if value is not None:
.... __builtin__.__last__ = value
.... sys.stdout.write("%r\n" % value)
....
Now the last non-None value will be stored in __last__ instead of _:
Traceback (most recent call last):
1

Peter
 
H

Hans-Joachim Widmaier

Am Sat, 03 Apr 2004 23:22:47 +0200 schrieb Peter Otten:
Try redefining sys.displayhook, e. g.:

Thanks a lot! This is the stuff I keep having problems with finding in the
docs.

[Sorry for answering late, but Google gave me only empty pages, and I'm
just now able to do it properly.]

Hans-Joachim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top