Raymond Hettinger added the comment: Oscar, the solution proposed by Serhiy looks like a better choice.
I'm wary of increasing the API complexity of the itertools. Right now, their learnability is aided by having simple signatures and no side-values. The itertools are modeled on functional tools in other languages with mature APIs. I look to those languages to provide an indication of whether proposed features are needed in practice. AFAICT, there is no precedent for a takewhile-with-failed-value combo. I appreciate your request (especially because it was accompanied by a use case) but am going to decline. IMO, the module as a whole is better served by keeping the tools simple and clean. If an individual itertool doesn't have an exact fit to a particular use case, it may indicate that the programmer would be better served by a simple generator which can express the logic more cleanly than a tricked-out itertool with side-values. ---------- resolution: -> rejected status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18821> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com