Python state-machine design
Related to this Stack Overflow question (C state-machine design) , could you Stack Overflow folks share your Python state-machine design techniques with me (and the community)? At the moment, I am going for an engine based on the following: class TrackInfoHandler(object): def __init__(self): self._state="begin" self._acc="" ## ================================== Event callbacks def startElement(self, name, attrs): self._dispatch(("startElement", name, attrs)) def characters(self, ch): self._acc+=ch def endElement(self, name): self._dispatch(("endElement", self._acc)) self._acc="" ## ===========