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/2005-May/053802.html below:

[Python-Dev] Tidier Exceptions

[Python-Dev] Tidier ExceptionsGreg Ewing greg.ewing at canterbury.ac.nz
Mon May 16 09:49:35 CEST 2005
Aahz wrote:
> On Fri, May 13, 2005, Greg Ewing wrote:
>
>>Instead of an 'args' attribute, I'd suggest that the constructor take
>>keyword arguments and store them in corresponding attributes.
> 
> Sounds reasonable, but it should be equally easy to handle::
> 
>     raise MyError, "message"

Certainly, I wasn't suggesting otherwise.

To be more explicit, the base exception class would
look something like

   class Exception:

     def __init__(self, message = None, **kwds):
       self.message = message
       self.__dict__.update(kwds)

     def __str__(self):
       if self.message is not None:
         return self.message
       else:
         return self.__class__.__name__

Greg

More information about the Python-Dev mailing list

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