[Python-Dev] AC Derby and accepting None for optional positional arguments
tjreedy at udel.edu
Thu Jan 16 10:42:43 CET 2014
On 1/16/2014 3:31 AM, Serhiy Storchaka wrote:
> 16.01.14 08:05, Guido van Rossum написав(ла):
>> In this specific case it's clear to me that the special-casing of
>> negative count is intentional -- presumably it emulates sequence
>> repetition, where e.g. 'a'*-1 == ''.
> In this specific case it's contrary to sequence repetition. Because
> repeat('a', -1) repeats 'a' forever.
'Forever' only when the keyword is used and the value is -1.
>>> itertools.repeat('a', -1)
>>> itertools.repeat('a', times=-1)
>>> itertools.repeat('a', times=-2)
> This is a point of Vajrasky's issue .
The first line is correct in both behavior and representation.
The second line behavior (and corresponding repr) are wrong.
The third line repr is wrong but the behavior is like the first.
>  http://bugs.python.org/issue19145
Terry Jan Reedy
More information about the Python-Dev