Stefan Behnel <stefan...@behnel.de> writes: > > The series of tests is written that way because there is no case > > statement available. It is essentially switching on a bunch of > > character constants and then doing some additional tests in each > > branch. > Although doing some of the tests first and then checking the input > conditionally might be faster here.
That is essentially what happens. There are a bunch of tests of the form if data=='<' and [some other stuff]: ... Because of short-circuit evaluation of "and", the additional tests only happen once the character has been matched. -- http://mail.python.org/mailman/listinfo/python-list