Paul Rubin wrote: > Stefan Behnel 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]: ...
That's what I meant. Some of the "other stuff" is redundant enough to do it once at the beginning of the function (or even before entering the function, by writing specialised methods), i.e. I'd (partially) reverse the order of the "and" operands. Stefan -- http://mail.python.org/mailman/listinfo/python-list