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 lehmannro
Recipients lehmannro, pitrou, rhettinger
Date 2009-01-23.15:34:05
SpamBayes Score 2.2121933e-09
Marked as misclassified No
Message-id <1232724861.96.0.373421322876.issue5034@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-01-23 15:34:22lehmannrosetrecipients: + lehmannro, rhettinger, pitrou
2009-01-23 15:34:21lehmannrosetmessageid: <1232724861.96.0.373421322876.issue5034@psf.upfronthosting.co.za>
2009-01-23 15:34:06lehmannrolinkissue5034 messages
2009-01-23 15:34:05lehmannrocreate