A little disappointed so far

Alex Martelli aleax at aleax.it
Mon May 19 04:07:57 EDT 2003


On Monday 19 May 2003 09:58 am, Ian Bicking wrote:
   ...
> If you don't try to handle the error yourself, you get a long-winded and
> distracting traceback, but you also get the appropriate message.  The
> "idiom" for primitive error handling is nil -- don't do anything, and
> errors happen loudly and with some diagnostic information.  So I think

Yes, I do like Python's principle that errors should never pass silently
unless explicitly silenced.  But that's separate from the issue of what
information should be provided when the error is not made to pass
silently -- which in Python is often what one wants, to avoid the long
and distracting traceback you mention (admittedly best handled in
sys.excepthook, but that's a somewhat-advanced technique).

> it *is* Perl's fault that doing even primitive error handling requires
> an idiom.

Yes, but that idiom in its common form does include the error detail
information (via $!).  Faulting Perl for incorrect use of its common
idioms is just about as sensible as faulting Python for the same thing
(e.g. people putting toplevel statements right at module level without
the idiomatic "if __name__=='__main__':" trick and thereby making a
module not usefully import'able) -- i.e., not very.


> But arguing on Perl's flaws is probably silly in a Python group...

When we're comparing the Perl and Python approaches to some issue
to help a Perl expert move to Python it's anything but silly to discuss
both sides of the coin.


Alex






More information about the Python-list mailing list