Debugging pipe IPC

Jim B. Wilson wilson at afn.org
Tue Dec 18 12:39:53 EST 2007


Ian Clark wrote:

> ... whatever 'mother' was sending it ("Clean your room!" most like)

:)

> If it's very verbose ...

Alas, it is quite verbose.  Constructing a single instance of a class
(from the Pyrex extension acting as the child's two-way radio) could
involve tens of thousands of more-or-less random exchanges between
mother and child.  A subsequent method call could trigger a similar
volume of traffic.

And it isn't this communication I'm worried about.  All that seems to go
quite well.  My fondest wish is to play the role of the child at the
good old ">>>" prompt.  Such play would allow me to test tiny snippets
of code that I could later incorporate into an actual child.

My wish may not be possible.  If so, it's no great tragedy.  A simple
test goes from:

	>>> foo = askmommy()
	>>> foo.why()

to:

   1. Typing similar statements into my editor.
   2. Saving these statements to a file, say "test.py".
   3. Making clicky-clicky in the mother application to run "test.py".
   4. Noticing that nothing appears on my terminal.
   5. Inserting ">>sys.stderr," into "print foo.why()" :)
   6. Repeating steps 2 and 3.

Steps 4, 5 and 6 are required because the mother has absolutely no
compunction against infanticide when her child asks her a question she
cannot answer.

If my wish isn't possible, it will be the first time.  Normally, when I
wonder if Python can do something, I imagine what the syntax would be if
it could, type it in, and sure enough it works.

Jim



More information about the Python-list mailing list