> def bounds_check(state):
> """ check state values are > 0 """
> for attr in dir(state):
> if not attr.startswith('__') and getattr(state, attr) < 0.0:
> print "Error state values < 0: %s" % (attr)
> sys.exit()
Not that related to the question. But it's usually better to raise an exception.
Exiting in the middle of a function usually make debugging later more
"interesting".
You might find Traits interesting for validation, see
http://code.enthought.com/projects/traits/
HTH
--
Miki Tebeka <[email protected]>
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list