[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Python or Perl for a Debian maintainance project?

Andrew Suffield writes:
> On Thu, Feb 19, 2004 at 06:32:53PM -0600, John Goerzen wrote:
> > On Thu, Feb 19, 2004 at 08:35:05PM +0000, Andrew Suffield wrote:
> > > The only way to get shorter is to not handle the errors - which is the
> > > norm in python.
> >
> > It's no different than Perl.
> Yes, precisely my point. What's yours?
> > Actually, Python's *default* error will be more useful that
> > most *coded* errors in Perl since Python includes not only the type of
> > error (in the form of the exception object), but also the errors
> > description, thread in which it occured (with a name, if the thread was
> > named), and full stack trace.
> Factually incorrect, because you get all that with perl too, and
> python's default error doesn't give you a meaningful description. See
> the Carp documentation.
> > Also, lots of code -- both Perl and C -- does not even check for errors
> > at all.  It is extremely commonplace to see calls to write() that never
> > check for errors in C, or calls to printf or print or whatever your
> > output function is.  In my book, that's worse.
> Vomiting to the screen is not better than aborting. And comparing
> the quality of broken code is silly.
> > There is no such thing as an I/O operation without an error check in
> > Python, and in my book, that is an incredibly Good Thing.
> There's a perl module that calls die "moo" on every IO error if that's
> what you really want, but nobody uses it because when they think about
> it, that is not what they want. They want a *useful* error
> message. Not an obtuse message suggesting that there might be some
> sort of error.

I couldn't agree more. That's why I like it more like this:

> python
Python 2.3.3 (#2, Jan 13 2004, 00:47:05)
[GCC 3.3.3 20040110 (prerelease) (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> input = file('thisfiledoesnotexist')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 2] No such file or directory: 'thisfiledoesnotexist'
>>> input = file('norights.txt')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 13] Permission denied: 'norights.txt'
>>> import os
>>> os.rmdir('tmp')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OSError: [Errno 39] Directory not empty: 'tmp'



Reply to: