New submission from Vajrasky Kok: >>> from itertools import repeat >>> repeat(2, -10).__length_hint__() 0 >>> repeat(2, times=-10).__length_hint__() 18446744073709551606 >>> repeat(2, times=-10) repeat(2, -10) >>> repeat(2, -10) repeat(2, 0)
Hereby, I attached two alternatives of patch to make the behaviour consistent. The first one makes the negative number parameter/keyword ALWAYS means endless. ---------- components: Library (Lib) files: fix_itertools_repeat_negative_number_means_endless.patch keywords: patch messages: 198849 nosy: vajrasky priority: normal severity: normal status: open title: Inconsistent behaviour in itertools.repeat when using negative times type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file31943/fix_itertools_repeat_negative_number_means_endless.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19145> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com