I use custom classes and the "is" operator... that way, things don't get confused with integers, and I have an object where repr(state) will give me more than an integer. (the integer approach works well enough but seems like a case of "I can program C in ANY language!")
opened = type('opened', (object,), {}) closed = type('closed', (object,), {}) error = type('closed', (object,), {}) if thing.state is opened: ... elif thing.state is error: ... etc -- http://mail.python.org/mailman/listinfo/python-list