classification
Title: Inconsistent itertools' predicate behaviour
Type: enhancement Stage:
Components: Extension Modules Versions: Python 3.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: franciscouzo, rhettinger, serhiy.storchaka
Priority: normal Keywords:

Created on 2016-11-03 02:38 by franciscouzo, last changed 2016-11-05 05:28 by rhettinger. This issue is now closed.

Messages (4)
msg279960 - (view) Author: Francisco Couzo (franciscouzo) * Date: 2016-11-03 02:38
As per Terry's recommendation https://mail.python.org/pipermail/python-dev/2016-November/146791.html

Currently some functions in itertools (dropwhile and takewhile), don't accept None as a predicate, but filterfalse and groupby do.

I'd like your input, and I'm interested in writing a patch.
msg280092 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-11-04 21:54
I think that the simpler signature is better, that the None argument isn't clear, and that there aren't use cases that warrant and API churn.

On your last post, it seemed that you were withdrawing the request.  Can this tracker item be closed now?
msg280095 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-11-04 22:29
Note that the predicate is optional argument in groupby but mandatory in dropwhile and takewhile. I suppose that filter and filterfalse accept None for historical reason (they precede bool).
msg280096 - (view) Author: Francisco Couzo (franciscouzo) * Date: 2016-11-04 23:10
I think removing None as a valid predicate to filterfalse would make the API simpler, but I don't know if it's worth the API change, please do close the issue if you think it's not worth it.
History
Date User Action Args
2016-11-05 05:28:05rhettingersetstatus: open -> closed
resolution: rejected
2016-11-04 23:10:34franciscouzosetmessages: + msg280096
2016-11-04 22:29:29serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg280095
2016-11-04 21:54:36rhettingersetmessages: + msg280092
2016-11-04 21:54:27rhettingersetmessages: - msg280091
2016-11-04 21:47:01rhettingersetassignee: rhettinger
messages: + msg280091
components: + Extension Modules
versions: + Python 3.7
2016-11-03 02:38:15franciscouzocreate