On Thu, Apr 2, 2015 at 10:29 PM, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote: > On 04/03/2015 02:31 PM, Nick Coghlan wrote: >> >> If I'm understanding PJE's main concern correctly it's that this >> approach requires explicitly testing that the decorator has been >> applied correctly in your automated tests every time you use it, as >> otherwise there's a risk of a silent failure when you use the >> decorator but omit the mandatory base class that makes the decorator >> work correctly. > > > Could the decorator be designed to detect that situation > somehow? E.g. the first time the decorated method is called, > check that the required base class is present.
No, because in the most relevant use case, the method will never be called if the base class isn't present. For more details, see also the previous discussion at https://mail.python.org/pipermail/python-dev/2012-June/119883.html _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com