[Python-Dev] itertools predicates

Francisco Couzo franciscouzo at gmail.com
Fri Nov 4 15:35:17 EDT 2016

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.hettinger at gmail.com> wrote:

> > On Nov 3, 2016, at 3:51 PM, Steven D'Aprano <steve at pearwood.info> 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
> > 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?".
> I concur with Steven who articulated the issue perfectly.  There isn't an
> actual problem here that needs to be solved (i.e. not a single user report
> in 15 years indicating that the API wasn't meeting the needs for real
> use-cases).  I'm disinclined to churn the API unless there is a real need.
> FWIW, groupby() has the predicate as an optional argument so that you can
> write groupby('aaabbc') and have it group by value (much like the
> key-function on sorted() is optional).   The two filter variants allow None
> as the first argument only for historical reasons -- once "bool" came
> along, it would have been better to write filter(bool, someiterable) in
> preference to using None which is less clear about its intention.  The
> takewhile/dropwhile tools didn't have the same constraint to match a
> historical API, so there was an opportunity to have a clearer API with a
> simpler signature.
> As Terry suggested, if you have other itertools feature requests, please
> put them on the tracker an assign them to me.
> Thank you,
> Raymond
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> franciscouzo%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20161104/85def0f0/attachment.html>

More information about the Python-Dev mailing list