Try Python update

Mike Meyer mwm at mired.org
Wed Jan 4 05:03:51 CET 2006


browerg at verizon.net 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:
http://www.mired.org/home/mwm/try_python/ >, or Devans <URL:
http://www.datamech.com/devan/trypython/trypython.py >? 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.

     thanks,
     <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list