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

Larry Hastings larry at hastings.org
Sat Feb 1 04:23:52 CET 2014

On 01/28/2014 09:18 PM, Ethan Furman wrote:
> On 01/28/2014 06:50 PM, Larry Hastings wrote:
>> I think the "times behaves differently when passed by name versus 
>> passed by position" behavior falls exactly into this
>> category, and its advice on how to handle it is sound.
> I don't agree with this.  This is a bug.  Somebody going through (for 
> example) a code review and making minor changes so the code is more 
> readable shouldn't have to be afraid that [inserting | removing] the 
> keyword in the function call is going to *drastically* [1] change the 
> behavior.  I understand the need for a cycle of deprecation [2], but 
> not fixing it in 3.5 is folly.

It's a bug.  But it's also a longstanding bug, having been a part of 
Python since 2.7.

Python is the language that cares about backwards-compatibility--bugs 
and all.  If your code runs on version X.Y, it should run without 
modification on version X.(Y+Z) where Z is a positive integer.

Therefore it would be inappropriate to remove the "times=-1 when passed 
by keyword repeats indefinitely" behavior without at /least/ a full 
deprecation cycle.  Personally I'd prefer to leave the behavior in, 
undocumented and deprecated, until Python 4.0.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140131/7f257f88/attachment.html>

More information about the Python-Dev mailing list