peter at engcorp.com
Fri Jan 6 17:18:08 CET 2006
> try this:
> class x(object):
> def __init__(self):
> self.someName = "hello"
> def someMethod(self):
> self.sumName = "bye"
> find that bug.
You forgot to include unit tests for someMethod(). Those would have
caught the bug.
The reality is that if you aren't doing unit testing, you aren't
catching other bugs either, bugs which aren't caught by the compile-time
tests in other languages and which aren't caught by PyChecker or PyLint
either. Bugs which are probably much more common than typos like the
Still, if you are really bothered by these things frequently, I believe
recipes have been posted in the past which *do* allow you to avoid many
such problems, by declaring the acceptable attribute names somewhere and
using one of Python's many hooks to intercept and check attribute
setting. Check the archives or the CookBook.
More information about the Python-list