On Wed, Apr 23, 2014 at 9:28 AM, Phil Frost <ind...@bitglue.com> wrote: > Rather than make guesses that are right 90% of the time and yield 10% > false positives, pyflakes takes the PEP 20 approach: ... > It is the opinion of pyflakes that determining the correctness of your > program in such complex situations is better served by unit tests.
Thanks for the response. How would a unit test tell me a particular method or data attribute is unused within the module? And if the attribute used to be used, but no longer is (and should be deleted to ease maintenance), does a unit test keep it alive? The main Python code base I work with is now more than 10 years old, and was not designed at the outset to easily support the creation of unit tests. (Numbers-wise, it's nearly 50kloc in over 200 Python files.) It also grew organically as requirements and focus of the code changed. I'm sure there's now a ton of unused code in there I could just discard. Finding it can be a challenge. Just because an attribute isn't used within a module doesn't mean it's dead, but in certain situations it would be nice if a checker could at least warn me, "hey, I see that you assigned to 'self.foo', but I don't see any obvious uses of that attribute within the class or module." I would be more than happy with a 90% hit rate on such stuff. I don't care about perfection here. I don't care about the craziness of assigning something bizarre to "self" or use of getattr and its cousins. I also would be happy if I needed to set a config variable or add a command line flag to enable such behavior. And if we are using the Zen of Python as our guide: Special cases aren't special enough to break the rules. Although practicality beats purity. I'm looking for practicality here, not purity. Skip _______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality