incorrect DeprecationWarning?

Alan G Isaac alan.isaac at gmail.com
Fri Sep 4 18:24:35 EDT 2009


Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class MyError(Exception):
...     def __init__(self, message):
...         Exception.__init__(self)
...         self.message = message
...
>>> e = MyError('msg')
__main__:4: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6


So?  Why would that mean I cannot add such an attribute
to derived classes?

Contrast:

Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class MyError(Exception):
...     def __init__(self, message):
...         Exception.__init__(self)
...         self.msg = message
...
>>> e = MyError('msg')

Beyond odd.  A bug?

Alan Isaac




More information about the Python-list mailing list