hg <[EMAIL PROTECTED]> writes: > I spent a few hours find this bug: > > value == self.Get_Value() > if value == WHATEVER: > do this > > instead of > value = self.Get_Value() > if value == WHATEVER: > do this > > Is there a way to avoid such a bug with some type of construct ?
Use pylint to check your code for common mistakes. <URL:http://www.logilab.org/projects/pylint> ===== bad_assign.py ===== """ Demonstrate a logical error """ value = None value == 10 if value == 10: print "Yep" else: print "Nope" ===== $ python ./bad_assign.py Nope $ pylint ./bad_assign.py ************* Module bad_assign C: 2: Invalid name "value" (should match (([A-Z_][A-Z1-9_]*)|(__.*__))$) W: 4: Statement seems to have no effect [...] -- \ "When I was crossing the border into Canada, they asked if I | `\ had any firearms with me. I said, 'Well, what do you need?'" | _o__) -- Steven Wright | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list