[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

Marcos Dione report at bugs.python.org
Thu Sep 8 08:48:32 EDT 2016


New submission from Marcos Dione:

If the `step` parameter for `itertools.count()` rounds to 1 (f.i., 1.1, 1.437643, 1.99999), then it fallsback to fast (integer) mode and increases the counter by 1. Here's an example:

Python 3.6.0a4+ (default:ddc95a9bc2e0+, Sep  8 2016, 14:46:19)
>>> import itertools
>>> for i in itertools.count(1, step=1.5):
...     print(i)
...     if i > 10:
...         break
1
2
3
4
5
6
7
8
9
10
11

----------
components: Library (Lib)
messages: 275007
nosy: StyXman
priority: normal
severity: normal
status: open
title: itertools.count() falls back to fast (integer) mode when step rounds to 1
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28019>
_______________________________________


More information about the Python-bugs-list mailing list