[Python-Dev] PEP 487 vs 422 (dynamic class decoration) (original) (raw)

PJ Eby pje at telecommunity.com
Fri Apr 3 05:07:49 CEST 2015


On Thu, Apr 2, 2015 at 9:31 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:

On 3 April 2015 at 08:24, Martin Teichmann <lkb.teichmann at gmail.com> wrote: However, I'm also now wondering if it may be possible to reach out to the pylint authors (similar to what Brett did for the "pylint --py3k" flag) and ask for a way to make it easy to register "base class, decorator" pairs where pylint will complain if it sees a particular method decorator but can't determine at analysis time if the named base class is in the MRO for the class defining the method.

Will it also check the calling chain of the decorator, or any other thing that's called or invoked in the class body,to find out if somewhere, somehow, it asks for a class decoration? If not, it's not going to help with this use case.

There are many ways to solve this problem by re-adding a hook -- you and I have proposed several, in 2012 and now.

There are none, however, which do not involve putting back the hookability that Python 3 took out, except by using hacks like sys.set_trace() or monkeypatching build_class.



More information about the Python-Dev mailing list