On 7/7/07, Gustavo Carneiro <[EMAIL PROTECTED]> 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's going away in Python 3.0. In retrospect the attribute was a mistake thanks to its odd semantics to be backwards compatible in a reasonable way. Plus its removal from the code base was nasty mostly thanks to C-based exceptions. > .../gobject/option.py:187: DeprecationWarning: BaseException.message has > been deprecated as of Python 2.6 > gerror.message = str(error) You can get around this easily enough with a subclass that uses a property for message:: class gerror(Exception): def _get_message(self, message): return self._message def _set_message(self, message): self._message = message message = property(_get_message, _set_message) -Brett _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com