dateutil/dateutil — pull request #17 by pganssle (2014-12-30 16:33:36+00:00)
Title: Loop fix

Converted most of the `while True` loops to explicit `for` loops looping over a length after which the pattern repeats, then raise an error if the pattern hasn't broken by then. I did a little refactoring in the looping logic, but not much since I think a lot of it won't end up being used in `rrule2` anyway. I'm a bit curious as to why we're explicitly handling the low-level operations of incrementing the day rather than incrementing a `datetime.datetime` object using `datetime.timedelta` objects - is this for the sake of performance or something? I can't imagine it would add much overhead, and it would be much easier to maintain.

I also converted the `by_` tuples to sets, because it doesn't seem that their order is ever used, but there are frequent calls to `in`, which will be considerably sped up by the use of sets. While I was doing that, I did some refactoring in the constructor which will make it easier to switch back if this change proves undesirable.