Robert Lehmann <lehman...@gmail.com> added the comment: When I started writing this patch this was actually what I intended. But having ``fixlen(range(3), 2)`` return 0 1 2 struck me as odd. Renaming the function to `pad` would help there indeed.
It depends on which use case is more common: either fixing an iterator to a certain length (slicing/padding applied as required) or obtaining an iterator of *at least* some number of elements (padded as required)? The thread on python-ideas suggests the latter while the example Python code brought up there implements the former. OTOH the latter cannot be composed *that easily* of other itertools but the former is more useful for unpacking. On a related note: what should happen if `length` is negative? `itertools.repeat` just defaults to 0 in such cases but I am unsure how applicable that is in this case. _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5034> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com