[issue34109] Accumulator bug

2018-07-13 Thread Victor Pires
Victor Pires added the comment: Sorry, you are right -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue34109] Accumulator bug

2018-07-13 Thread Victor Pires
Change by Victor Pires : Removed file: https://bugs.python.org/file47689/Bug.html ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue34109] Accumulator bug

2018-07-13 Thread Tim Peters
Tim Peters added the comment: ? I expect your code to return -1 about once per 7**4 = 2401 times, which would be about 400 times per million tries, which is what your output shows. If you start with -5, and randint(1, 7) returns 1 four times in a row, r5 is left at -5 + 4 = -1. --

[issue34109] Accumulator bug

2018-07-13 Thread Victor Pires
New submission from Victor Pires : A function to return a number from 1 to 5 (inclusive) sometimes returns -1 when called thousands of times. from random import randint import sys def rand5(): """Returns a random integer from 1 to 5 (inclusive)""" r5 = -5 # This *should* accumulate fr