Re: [Python-Dev] itertools predicates

2016-11-04 Thread Francisco Couzo
Well sorry about it, I didn't know about that PEP 8 line, disregard this thread then :) On Fri, Nov 4, 2016 at 2:29 PM, Raymond Hettinger < raymond.hettin...@gmail.com> wrote: > > > On Nov 3, 2016, at 3:51 PM, Steven D'Aprano wrote: > > > > Before there can be a solution,

Re: [Python-Dev] itertools predicates

2016-11-04 Thread Raymond Hettinger
> On Nov 3, 2016, at 3:51 PM, Steven D'Aprano wrote: > > Before there can be a solution, there first has to be a problem that > needs solving. "Lack of consistency" is not necessarily a problem. The > intertools functions are quite different, they do different things with

Re: [Python-Dev] itertools predicates

2016-11-03 Thread Steven D'Aprano
On Wed, Nov 02, 2016 at 07:03:27PM -0300, Francisco Couzo wrote: > Some functions that take a predicate from itertools accept None as its > predicate: [...] > I'd be interested in writing a patch to make itertools more consistent if > there's a consensus. There's a line in PEP 8 about foolish

Re: [Python-Dev] itertools predicates

2016-11-03 Thread Francisco Couzo
Stephen, dropwhile(None, ...) was an example, takewhile(None, ...) doesn't works either and it makes a lot of sense IMO. On Thu, Nov 3, 2016 at 7:07 AM, Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > Francisco Couzo writes: > > > I'd be interested in writing a patch to make

[Python-Dev] itertools predicates

2016-11-03 Thread Stephen J. Turnbull
Francisco Couzo writes: > I'd be interested in writing a patch to make itertools more consistent if > there's a consensus. I don't understand what you mean by "consistent". I would argue that in Python, an argument of None means "use the TOOWTDI default". For "filterfalse", bool() is pretty

Re: [Python-Dev] itertools predicates

2016-11-02 Thread Terry Reedy
On 11/2/2016 6:03 PM, Francisco Couzo wrote: Some functions that take a predicate from itertools accept None as its predicate: list(itertools.filterfalse(None, range(10))) [0] list(itertools.groupby([0,0,1,1], None)) [(0, ), (1, )] While others don't: list(itertools.dropwhile(None,

[Python-Dev] itertools predicates

2016-11-02 Thread Francisco Couzo
Some functions that take a predicate from itertools accept None as its predicate: >>> list(itertools.filterfalse(None, range(10))) [0] >>> list(itertools.groupby([0,0,1,1], None)) [(0, ), (1, )] While others don't: >>> list(itertools.dropwhile(None, range(10))) Traceback (most recent call