Re: Python or Perl for a Debian maintainance project?
On Thu, Feb 19, 2004 at 12:10:18PM -0500, Joey Hess wrote:
> Matthias Urlichs wrote:
> > f=create_a_file(name)
> > try:
> > do_something_insanely_complicated(f)
> > except:
> > os.unlink(f)
> > raise
> >
> > What this does is fairly obvious. What's more, this is a fairly standard
> > Python idiom which quickly becomes second nature (IMHO).
> >
> > Now try the same thing in Perl.
>
> $f=create_a_file($name);
> eval {
> do_something_insanely_complicated($f);
> };
> if ($@) {
> unlink $name;
> die $@;
> }
The principal difference being that $@ is a string, while the exception
raised in Matthias' is a real exception. This means that various error
conditions can be handled programmatically, rather than aborting with an
error message.
--
- mdz
Reply to: