Ammar Askar added the comment:
The behavior is documented here:
https://docs.python.org/3.9/library/stdtypes.html#numeric-types-int-float-complex
> Numeric literals containing a decimal point or an exponent sign yield
> floating point numbers.
--
nosy: +ammar2
_
Yaroslav Nikitenko added the comment:
Hello Raymond. Many thanks for your explanation.
In this case I suggest any of the following:
1) distinguish between integer and floating numbers in scientific notation.
Definitely, 1e+6 is an integer. I can't see where else numbers in scientific
notati
Raymond Hettinger added the comment:
Hello Yaroslav. What you've observed was a intentional change to make islice()
behave more like regular slices. Neither of those accept floats which are
precarious to use for indexing.
A workaround is to replace 1e+6 with 10**6.
--
nosy: +rhett
New submission from Yaroslav Nikitenko :
Numbers written in scientific notation don't work with itertools.islice.
Check this script:
# a usual function works
## def works as well
f = lambda x : x
f(1e+6)
# 100.0
import itertools
# islice without scientific notation works
itertools.islice