Could Emacs be rewritten in Python?

Carl Banks imbosol-1050441179 at aerojockey.com
Tue Apr 15 18:44:26 EDT 2003


Robin Munn wrote:
> I suppose I just illustrated how a try ... finally block might be
> considered "broken and fragile". I tried to use it, and missed some
> subtleties. I'm still not convinced that a "with"-like statement is
> necessary in Python, but I think I just went from -1 to -0 on it.

I wouldn't be so hasty.

First, you're basing it on a bad example.  Rebinding sys.stdout is bad
programming, period.  Wanting to save and restore it is even worse.
You might need this if you can't change the code you're calling, but
ordinarily, you should run away screaming from this kind of thing.
So, do you really want to go to -0 based on an example that really has
no business existing?

Second, that the "rebinding" statement should come before the "try:"
is *not* a subtlety.  It's the idiomatic way to do it, as familiar to
those who use it as the "while 1: break" idiom.


-- 
CARL BANKS




More information about the Python-list mailing list