Catching errors in attribute names at assigment
Duncan Booth
me at privacy.net
Tue Jun 22 04:24:03 EDT 2004
tkpmep at hotmail.com (Thomas Philips) wrote in
news:b4a8ffb6.0406211000.dd207c4 at posting.google.com:
> Is there a way to check assignments when they are made and to allow
> only those that modify a restricted set of allowable attributes?
> Looking through ClassName.__dict__.keys() is perhaps one way to
> achieve this: Is there a simpler (i.e. more Pythonic) way to do it as
> well?
Two more Pythonic ways to do this:
Write lots of unit tests. That way you not only catch this specific problem
but lots of others as well.
Use PyChecker. That way you not only catch this specific problem but lots
of others as well.
More information about the Python-list
mailing list