This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author inglesp
Recipients inglesp, r.david.murray, rhettinger, vstinner
Date 2016-11-22.22:41:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479854517.07.0.123339755439.issue28776@psf.upfronthosting.co.za>
In-reply-to
Content
Victor, I'm not talking about redefining a method, and David, I don't think I'm talking about changing dynamic nature of the class dictionary.

All I'm suggesting is that if some code contains a class whose body defines the same method twice, Python should treat it as an error.  At the moment, as far as I can tell, the first method is ignored.  Is there any situation where this behaviour is useful?

Python already handles a somewhat similar situation by raising a SyntaxError when it encounters a function whose parameter list contains duplicates:

>>> def f(a, a):
...   pass
... 
  File "<stdin>", line 1
SyntaxError: duplicate argument 'a' in function definition
History
Date User Action Args
2016-11-22 22:41:57inglespsetrecipients: + inglesp, rhettinger, vstinner, r.david.murray
2016-11-22 22:41:57inglespsetmessageid: <1479854517.07.0.123339755439.issue28776@psf.upfronthosting.co.za>
2016-11-22 22:41:57inglesplinkissue28776 messages
2016-11-22 22:41:57inglespcreate