A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/021806.html below:

[Python-Dev] Deprecating string exceptions

[Python-Dev] Deprecating string exceptionsGuido van Rossum guido@python.org
Wed, 27 Mar 2002 15:56:48 -0500
> > > http://python.org/sf/518846 reports that new-style classes cannot be
> > > used as exceptions. I think it is desirable that this is fixed, but I
> > > also believe that it conflicts with string exceptions.
> > 
> > Can you explain this conflict?  Couldn't this be worked around by
> > making an exception for strings?
> 
> Currently, if you write
> 
> try:
>   raise "Hallo"
> except str:
>   pass
> 
> the exception will pass through. If "new-style classes" (aka types)
> are allowed, then the string /should/ be caught.

Gotcha.  But I could easily accept a bw compatibility rule that says
you can't have a subclass of str (that's not also a subclass of
Exception) in the except clause until string exceptions have been
removed from the language.  All of this is irrelevant though, because...

> > I think string exceptions are used enough that we should deprecate
> > them on a slower schedule.
> 
> If you follow Paul's rationale (exceptions should inherit from
> Exception), then the bug report could be closed, and no action would
> be needed until Exception becomes a type.

Fair enough; go ahead and close the bug.

--Guido van Rossum (home page: http://www.python.org/~guido/)



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4