[New-bugs-announce] [issue46574] itertools.count should work with non-number types

Mital Ashok report at bugs.python.org
Sat Jan 29 14:14:25 EST 2022


New submission from Mital Ashok <mital.vaja at googlemail.com>:

There's no reason that `count('', 'a')` for `'', 'a', 'aa', ...` or `count((), (1,))` for `(), (1,), (1, 1), ...` shouldn't work.

count(a, b) should be equivalent to accumulate(chain((a,), repeat(b)))

The docs don't strongly suggest that it won't work (it says *start* is a number, but the "roughly equivalent to" generator would work for str/tuple/etc)

----------
components: Library (Lib)
messages: 412095
nosy: Mital Ashok
priority: normal
severity: normal
status: open
title: itertools.count should work with non-number types
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46574>
_______________________________________


More information about the New-bugs-announce mailing list