Try Python update

Mike Meyer mwm at
Tue Jan 3 23:03:51 EST 2006

browerg at writes:
> I like the form, no matter what its limitations may be. Three notes:
> It might be a good way to catch newbi mistakes (those are the kind I
> make :P, thereby providing a feedback loop to improved error messages.

I'm doing almost no error catching. I think I catch two:

If you muck with the prompt, it throws away what you sent it, because
I'd have to guess at the expression.

There were (I think I worked around them) browser bugs that caused
the result of an expression to get lost - it notices that, and tells
you about it.

Well, I do catch exceptions in general, to tailor the traceback for
the environment. But that's all I do.

> I had no trouble with from math import *  followed by print pi, but
> there was no >>> prompt after the result appeared .. is that part of
> the 'closures' thing mentioned earlier?

Hmm. Are you looking at mine <URL: >, or Devans <URL: >? Mine doesn't
handle code (though he's provide pointers I plan on using to make it
do so). I think he said his has problems with closures.

> Then I followed you "type 'help'" suggestion, which had me in stitches
> (sorry, it's been a long day and the Knob Creek was kicking in) -- I
> got exactly the message you'd expect, about help not being recognized
> and maybe help() would work. That's what triggered the idea for
> trapping errors.

Hmm. help seems to work fine in both of them. license() fails the same
way in both of them (it tries to read from stdin, so....), which means
that you can probalby make help fail on them both if you work at it.

Mike Meyer <mwm at>
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list