Hi, When inheriting from "dict" and overriding methods, W0613 is issued on some methods:
=== class DictArgInstance(dict): def __delitem__(self, key): raise TypeError('attempt to modify read-only dictionary') def __setitem__(self, key, value): raise TypeError('attempt to modify read-only dictionary') def clear(self): raise TypeError('attempt to modify read-only dictionary') def pop(self, key, default): raise TypeError('attempt to modify read-only dictionary') def popitem(self): raise TypeError('attempt to modify read-only dictionary') def setdefault(self, key, default): raise TypeError('attempt to modify read-only dictionary') def update(self, d, **kvargs): raise TypeError('attempt to modify read-only dictionary') === W0613: 12:DictArgInstance.pop: Unused argument 'default' W0613: 12:DictArgInstance.pop: Unused argument 'key' W0613: 18:DictArgInstance.setdefault: Unused argument 'default' W0613: 18:DictArgInstance.setdefault: Unused argument 'key' W0613: 21:DictArgInstance.update: Unused argument 'kvargs' W0613: 21:DictArgInstance.update: Unused argument 'd' === Apparently "__delitem__" and "__setitem__" are recognized as super class methods and W0613 is suppressed there. But that is not the case for "pop", "setdefault" and "update". As "dict" is implemented in native code, the way to get information about it is through introspection. I have been unable to find "__code__" attributes on the problematic methods though. Does anyone know how to get information about argument count and names for methods implemented as <type 'method_descriptor'>? An alternative to introspection would be to have hardcoded information about built-in classes, but that could get outdated when new optional arguments are added in new Python versions. Also it would only solve the problem for classes from Python itself. The fact that a method overrides another, as opposed to defining a new method, is easy to check. Therefore, an alternative would be to suppress W0613 when a method is overridden, even if the arguments of the method in the super class cannot be determined. Bye, Maarten The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message. _______________________________________________ Python-Projects mailing list Python-Projects@lists.logilab.org http://lists.logilab.org/mailman/listinfo/python-projects