Re: itertools py3.4 - filter list using not equal - fails as bool

2015-05-13 Thread Sayth Renshaw
Thank You for the explanations. I found this counter implementation is really cool and easily adaptable to more solutions. Thanks Alternatively collections.Counter() supports an arbitrary number of bins... import collections freq = collections.Counter(t[1] for t in stats) freq

Re: itertools py3.4 - filter list using not equal - fails as bool

2015-05-13 Thread Peter Otten
Sayth Renshaw wrote: why can't I filter a list based on an itertools condition using dropwhile? This is the docs and the example. https://docs.python.org/3/library/itertools.html#itertools.dropwhile def less_than_10(x): return x 10 itertools.takewhile(less_than_10,

Re: itertools py3.4 - filter list using not equal - fails as bool

2015-05-12 Thread MRAB
On 2015-05-12 23:43, Sayth Renshaw wrote: why can't I filter a list based on an itertools condition using dropwhile? This is the docs and the example. https://docs.python.org/3/library/itertools.html#itertools.dropwhile def less_than_10(x): return x 10 itertools.takewhile(less_than_10,

itertools py3.4 - filter list using not equal - fails as bool

2015-05-12 Thread Sayth Renshaw
why can't I filter a list based on an itertools condition using dropwhile? This is the docs and the example. https://docs.python.org/3/library/itertools.html#itertools.dropwhile def less_than_10(x): return x 10 itertools.takewhile(less_than_10, itertools.count()) = 0, 1, 2, 3, 4, 5, 6,