ESR's fortune.pl redone in python - request for critique

Peter Otten __peter__ at web.de
Wed Mar 31 08:14:44 EST 2004


Peter Otten wrote:

A wrong comment being as bad as a wrong error message, change the unrolled
loop to:

if random() < 1.0/1: chosen = "a" # index is 0, item is "a"
if random() < 1.0/2: chosen = "b" # index is 1, item is "b"
if random() < 1.0/3: chosen = "c" # index is 2, item is "c"
if random() < 1.0/4: chosen = "d" # index is 3, item is "d"




More information about the Python-list mailing list