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 erik.bray
Recipients erik.bray, jdemeyer, ncoghlan, rhettinger
Date 2018-06-22.14:11:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1529676712.45.0.56676864532.issue33939@psf.upfronthosting.co.za>
In-reply-to
Content
Per the discussion in https://trac.sagemath.org/ticket/24757, it would also be nice if some other common iterables like map and filter implemented a similar __length_hint__ which would interrogate whatever iterables were give as their argument(s).

To summarize the discussion in that ticket, it would be nice to at least know if I can expect some iterable to be finite without actually knowing its length.  Sure, if I passed in some arbitrary generator there's no way for the intepreter to know a priori if it will terminate.  But I would at least like to be able to manually mark whether I expect, as an intelligent developer, that under normal conditions the generator *should* terminate.  And this information should filter up to other iterators that I pass my generator to.  That way I can code defensively around whether or not I at least expect an iterator to be finite (even if not of a known length).
History
Date User Action Args
2018-06-22 14:11:52erik.braysetrecipients: + erik.bray, rhettinger, ncoghlan, jdemeyer
2018-06-22 14:11:52erik.braysetmessageid: <1529676712.45.0.56676864532.issue33939@psf.upfronthosting.co.za>
2018-06-22 14:11:52erik.braylinkissue33939 messages
2018-06-22 14:11:52erik.braycreate