On 10 avril 20:17, Dan Stromberg wrote: > The attached 3-file shar archive demonstrates a problem I saw in a larger > program. > > In short, when I use optparse (I usually do argument parsing by hand, so > hadn't noticed until working on someone else's code) in combination with > pylint, pylint doesn't appear to see what attributes should exist in the > "options" return from optparse, and what attributes should not. > > Pylint gives this code a 10/10 on my system, even though it's referencing a > nonexistent attribute. > > Is there something I can do to give pylint better visibility into what's > happening, short of rewriting with manual option parsing? Perhaps pylint > knows about some other option parsing module? > > Or are the usual argument parsers just too dynamic?
optparse is too dynamic to be understood by pylint / astng (which don't like setattr / __dict__ modification). Historically there is some hard-coded skip on optparse.Values instances. Though we could now develop some astng extension which would allow nicer understanding of it, using technic described in http://www.logilab.org/blogentry/78354. -- 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 Python-Projects@lists.logilab.org http://lists.logilab.org/mailman/listinfo/python-projects