[Python-Dev] Negative times behaviour in itertools.repeat for Python maintenance releases (2.7, 3.3 and maybe 3.4)

Vajrasky Kok sky.kok at speaklikeaking.com
Tue Jan 28 03:00:36 CET 2014


On Mon, Jan 27, 2014 at 9:13 PM, Larry Hastings <larry at hastings.org> wrote:
>
> I apologize for not making myself clear.  But that's part of what I meant,
> yes: we should preserve the existing behavior of times=-1 when passed in by
> position or by keyword.  However, we should *also* add a deprecation warning
> when passing times=-1 by keyword, suggesting that they use times=None
> instead.  The idea is that we could eventually remove the PyTuple_Size check
> and make times=-1 always behave like times=0.  In practice it'd be okay with
> me if we never did, or at least not until Python 4.
>

So we only add deprecation warning to only times=-1 via keyword or for
all negative numbers to times via keyword?

I mean, what about:
>>> from itertools import repeat
>>> list(repeat('a', times=-2))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C ssize_t

Deprecation warning or not?


More information about the Python-Dev mailing list