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/2007-July/073778.html below:

[Python-Dev] Python 2.6 BaseException.message deprecation, really needed?

[Python-Dev] Python 2.6 BaseException.message deprecation, really needed?Fred L. Drake, Jr. fdrake at acm.org
Sun Jul 8 02:51:45 CEST 2007
On Saturday 07 July 2007, Gustavo Carneiro wrote:
 > In PyGObject we want to use a 'message' attribute in an exception defined
 > by us.  The name 'message' comes from a C API, therefore we would like to
 > keep it for easier mapping between C and Python APIs.  Why does Python
 > have to deprecate this attribute?

It can be deprecated for BaseException without it being deprecated for your 
exception.  You'll need to define a property that overrides the property in 
BaseException; something like this in Python (not tested):

  class MyException(Exception):

      _message = None

      @apply
      def message():

          def get(self):
              return self._message

          def set(self, value):
              self._message = value

          return property(get, set)

I think your use case is entirely reasonable, and can be handled readily.


  -Fred

-- 
Fred L. Drake, Jr.   <fdrake at acm.org>
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