[Python-Dev] AC Derby and accepting None for optional positional arguments
Antoine Pitrou
solipsis at pitrou.net
Thu Jan 16 12:39:49 CET 2014
More information about the Python-Dev mailing list
Thu Jan 16 12:39:49 CET 2014
- Previous message: [Python-Dev] AC Derby and accepting None for optional positional arguments
- Next message: [Python-Dev] AC Derby and accepting None for optional positional arguments
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 16 Jan 2014 04:42:43 -0500 Terry Reedy <tjreedy at udel.edu> wrote: > 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. > In 3.4b2 > > >>> itertools.repeat('a', -1) > repeat('a', 0) > >>> itertools.repeat('a', times=-1) > repeat('a') > >>> itertools.repeat('a', times=-2) > repeat('a', -2) Looks like a horrible bug to me. Passing an argument by position should mean the same as passing it by keyword! Regards Antoine.
- Previous message: [Python-Dev] AC Derby and accepting None for optional positional arguments
- Next message: [Python-Dev] AC Derby and accepting None for optional positional arguments
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list