The start/stop/step sound like they might be nice. But that wouldn't give you a length, since you never know when an iterator will be exhausted. I feel like `len(islice(it, 1, 1_000_000))` telling you the "maximum possible length" is more a danger than a help.
On Wed, Aug 12, 2020 at 4:41 AM Mathew Elman <mathew.el...@ocado.com> wrote: > Is there a reason that itertools.islice does not provide its start, stop > and step values as attributes, similar to range? > This seems like a sensible and useful thing to have, and would also allow > islice's to have a __len__. > > Mathew > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/UQD5GKMAPSPSJ655EQOMZJS42OKBD754/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- The dead increasingly dominate and strangle both the living and the not-yet born. Vampiric capital and undead corporate persons abuse the lives and control the thoughts of homo faber. Ideas, once born, become abortifacients against new conceptions.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/35UIBIHDM4CL4IIZY7NQR3IR3EQAQXLT/ Code of Conduct: http://python.org/psf/codeofconduct/