Message320239
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). |
|
Date |
User |
Action |
Args |
2018-06-22 14:11:52 | erik.bray | set | recipients:
+ erik.bray, rhettinger, ncoghlan, jdemeyer |
2018-06-22 14:11:52 | erik.bray | set | messageid: <1529676712.45.0.56676864532.issue33939@psf.upfronthosting.co.za> |
2018-06-22 14:11:52 | erik.bray | link | issue33939 messages |
2018-06-22 14:11:52 | erik.bray | create | |
|