The following behavior further supports this interpretation.
>>> from itertools import * >>> ''.join(repeat('a', times=-4))Traceback (most recent call last):  File "", line 1, in  OverflowError: long int too large to convert to int 
The ReST documentation may benefit from an addition of a warning that behavior of repeat() is "undefined" when times is passed by keyword. 
">

(original) (raw)


On Sun, Jan 26, 2014 at 11:26 PM, Vajrasky Kok <sky.kok@speaklikeaking.com> wrote:
In case we are taking "not backporting anything at all" road, what is

the best fix for the document?



Old

>>> itertools.repeat.__doc__

'repeat(object [,times]) -> create an iterator which returns the

object\nfor the specified number of times. If not specified, returns

the object\nendlessly.'


I would say no fix is needed for this doc because the signature suggests (correctly) that passing times by keyword is not supported.

The following behavior further supports this interpretation.

>>> from itertools import \*
\>>> ''.join(repeat('a', times=-4))
Traceback (most recent call last):
File "", line 1, in
OverflowError: long int too large to convert to int

The ReST documentation may benefit from an addition of a warning that behavior of repeat() is "undefined" when times is passed by keyword.