What's TOTALLY COMPELLING about Ruby over Python?

Roy Smith roy at panix.com
Fri Aug 22 09:20:08 EDT 2003


In article <81smnteu60.fsf at darwin.lan.kassube.de>,
 Nils Kassube <nika at kassube.de> wrote:

> A nice feature of Ruby is that exceptions are resumable like in
> Smalltalk, ie. you can have a "retry" statement in your exception
> handling that allows you to "try again". 
> 
> http://www.rubycentral.com/book/tut_exceptions.html

I suppose this is nice, but does it really give you anything you 
couldn't get in a slightly different way by just enclosing the whole try 
construct in a loop?

while 1:
   try:
      do stuff
      break
   except:
      fix the problem

If "do stuff" throws an exception, the "fix the problem" code runs and 
then you try "do stuff" again.  It even suffers from the same potential 
infinite loop problem the Ruby version has :-)




More information about the Python-list mailing list