[issue28776] Duplicate method names should be an error

STINNER Victor report at bugs.python.org
Tue Nov 22 16:04:25 EST 2016


STINNER Victor added the comment:

Without modifying the language, I guess that it's already technically possible to implement that in Python 3 in an application. Using the __prepare__() method of a metaclass and a custom dict subclass, I think that you can build what you want. I mean that you would have to modify your classes to inherit from a base class (which uses the metaclass) and/or use the metaclass everywhere, to catch such bug...

I'm not sure that it's worth it. You don't want to have to modify your code to catch a single class of kind. Linters exist to check the code without having to modify it.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28776>
_______________________________________


More information about the Python-bugs-list mailing list