On 14 février 16:44, James Lingard wrote:
> I'm using the "ignored-classes" configuration option to disable the E1101
> error for a class which has some generated members.  Unfortunately, this
> seems to have no effect on subclasses of the ignored class.
> 
> I think it makes sense for any subclass of an ignored class to
> automatically be ignored, as otherwise attempting to access one of the base
> class generated members via an instance of a subclass will give an E1101
> error.

True
 
> The following patch implements this behaviour.
> 
> I suspect my patch is incredibly inefficient, as it will infer the types of
> every base class on every attribute access.  Is there a better way to do
> this?  Should I create a cache that maps a class to whether or not that
> class is ignored?

You should use cls.ancestors() which will do the recursion jobs first.
Beside this, yes it will be slow. Would you time the performance impact
on running pylint tests? According on this, we may think at adding a 
cache on .ancestors or even a specific cache as you propose.

PS: would you expose your patch as an mq patch in an accessible repository
so we can get it in the review process? If not no big deal...
-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (09.54.03.55.76)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to