B
bearophileHUGS
itertools.count docs say:
Does not currently support python long integers.
Note, count() does not check for overflow and will return negative
numbers after exceeding sys.maxint. This behavior may change in the
future.
But it seems it doesn't support negative numbers too:
.... yield n
.... n += 1
....[-3, -2, -1, 0, 1]
If this isn't a bug, then maybe docs can tell about this too.
Bye,
bearophile
Does not currently support python long integers.
Note, count() does not check for overflow and will return negative
numbers after exceeding sys.maxint. This behavior may change in the
future.
But it seems it doesn't support negative numbers too:
.... while True:from itertools import count, islice
list(islice(count(), 0, 5)) [0, 1, 2, 3, 4]
list(islice(count(10), 0, 5)) [10, 11, 12, 13, 14]
list(islice(count(-3), 0, 5)) [4294967293L, 4294967294L, 4294967295L, 0, 1]
def count2(n=0):
.... yield n
.... n += 1
....[-3, -2, -1, 0, 1]
If this isn't a bug, then maybe docs can tell about this too.
Bye,
bearophile