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 consistency. Consistency just for the sake of consistency is not a virtue. I have no objection to adding support for None to individual itertools functions on the basis that it makes sense for that function. If you can suggest a reasonable and *useful* default predicate or key function to use for None, then sure, add it to the tracker as a feature enhancement. (And, of course, a patch would be appreciated.) But that will be because it is a useful enhancement, not because of "consistency". > I see two possible solutions: 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 different APIs. The question here should not be "why don't these functions take None as an argument?", rather it should be "why should these functions take None as an argument?". -- Steve _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com