This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients pavel-lexyr, rhettinger, serhiy.storchaka
Date 2021-07-09.22:31:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1625869913.02.0.443237317222.issue44571@roundup.psfhosted.org>
In-reply-to
Content
> For convenience, the takewhile iterator can also have
> additional attributes: a boolean attribute which indicates 
> that the falsifying element is set, and dynamic attribute 
> which is equal to orig_iterator 
> or chain([odd_element], orig_iterator).

Rather than graft a funky and atypical API onto takewhile(), it would be better to have a new tool that returns two iterators, the true steam, and a stream for the remaining values.  Either stream may be empty.  There is no need for a boolean flag attribute or a remaining stream attribute.  This design fits in better with the other itertools.

FWIW, we can already do this using groupby(), but it is only easy if we assume the first part of the stream is all true and the remainder of the stream is all false.  That isn't good enough for general application.
History
Date User Action Args
2021-07-09 22:31:53rhettingersetrecipients: + rhettinger, serhiy.storchaka, pavel-lexyr
2021-07-09 22:31:53rhettingersetmessageid: <1625869913.02.0.443237317222.issue44571@roundup.psfhosted.org>
2021-07-09 22:31:53rhettingerlinkissue44571 messages
2021-07-09 22:31:52rhettingercreate