[Python-Dev] AC Derby and accepting None for optional positional arguments

Terry Reedy tjreedy at udel.edu
Thu Jan 16 23:01:56 CET 2014


> On Thu, Jan 16, 2014 at 1:42 AM, Terry Reedy <tjreedy at udel.edu> wrote:

>>>>> itertools.repeat('a', -1)
>> repeat('a', 0)
>>>>> itertools.repeat('a', times=-1)
>> repeat('a')
>>>>> itertools.repeat('a', times=-2)
>> repeat('a', -2)

>> 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.
>>
>>> [1] http://bugs.python.org/issue19145

On 1/16/2014 1:42 PM, Guido van Rossum wrote:
> If I had complete freedom in redefining the spec I would treat
> positional and keyword the same, interpret absent or None to mean
> "forever" and explicit negative integers to mean the same as zero, and
> make repr show a positional integer >= 0 if the repeat isn't None.
>
> But I don't know if that's too much of a change.

I copied the unsnipped stuff above to a tracker message.

http://bugs.python.org/issue19145

-- 
Terry Jan Reedy



More information about the Python-Dev mailing list