[Python-ideas] Decorator to avoid a mistake
Nick Coghlan
ncoghlan at gmail.com
Sat Nov 26 09:23:13 EST 2016
On 26 November 2016 at 22:24, France3 <fleblanc50 at gmail.com> wrote:
> replace base object by default, and when all is checked for end user
> don't use the flag...
>
> Does it is possible? What do you think about?
There's no need to do this in a base class, since it can be done via
external introspection. That introspection could live in at least a
couple of different places:
- a class decorator, which checks for unmarked overrides at class
definition time
- a test utility, that given a module name, imports the module, finds
any defined classes, and checks them for unmarked overrides
All an override marker would have to do to enable that introspection
is to set a particular attribute on the method definition.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list