pytoolz/cytoolz — pull request #2 by mrocklin (2014-04-06 16:04:40+00:00)
Title: Partition

OK, here is a "getting the feet wet" pull request.

At first I just relied on `zip` and `izip_longest`, as we do in toolz. This yielded a 30% speedup.

Then I tried making an iterator class and ran into weird issues. I get a fair number of stackoverflows. In particular I get some strange integer wraparound at 256. Does Cython use one byte integers somehow? Anyway, if you have any thoughts on debugging this I'd be interested.

Fail case on my machine

import cytoolz
list(cytoolz.partition(5, range(1000)))

oddly this works

list(cytoolz.partition(5, range(200)))

but this doesn't

timeit list(cytoolz.partition(5, range(200)))