incorrect DeprecationWarning?

Alan G Isaac alan.isaac at
Sat Sep 5 16:28:49 CEST 2009

On 9/5/2009 9:07 AM, exarkun at wrote:
> You are using the deprecated practice.

Clearly not, or it would fail in Python 3,
which it does not.

> Attributes are not scoped to a
> particular class. There is only one "message" attribute on your
> "MyError" instance. It does not belong just to "MyError". It does not
> belong just to "Exception". It does not belong just to "BaseException".
> It is shared by all of them.

No, it does not belong to any of those classes.
It belongs to the instance.

> Because "BaseException" deprecates
> instances of it having a "message" attribute

That is what is is doing, and that is precisely the problem.
The DeprecationError is raised for the wrong thing.
I mean be serious: this is flagging the use of
a new attribute on a subclass.  If you proposed building
a class that way the screams on "unPythonic" on this
list would be deafening.

I am not sure how best to deprecate dependence on the
Python 2.5 mistake, but this is not it.  And I know at
least one important library that is affected.

Alan Isaac

More information about the Python-list mailing list