[Python-checkins] cpython (3.6): Simplify code in an example
raymond.hettinger
python-checkins at python.org
Mon Nov 21 13:16:32 EST 2016
https://hg.python.org/cpython/rev/8f9f2033c1f0
changeset: 105294:8f9f2033c1f0
branch: 3.6
parent: 105292:b9801dab214a
user: Raymond Hettinger <python at rcn.com>
date: Mon Nov 21 10:16:01 2016 -0800
summary:
Simplify code in an example
files:
Doc/library/random.rst | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Doc/library/random.rst b/Doc/library/random.rst
--- a/Doc/library/random.rst
+++ b/Doc/library/random.rst
@@ -429,12 +429,12 @@
num_waiting = 0
arrival = service_end = 0.0
- for i in range(10000):
- num_waiting += 1
- arrival += expovariate(1.0 / average_arrival_interval)
- print(f'{arrival:6.1f} arrived')
-
- while arrival > service_end:
+ for i in range(20000):
+ if arrival <= service_end:
+ num_waiting += 1
+ arrival += expovariate(1.0 / average_arrival_interval)
+ print(f'{arrival:6.1f} arrived')
+ else:
num_waiting -= 1
service_start = service_end if num_waiting else arrival
service_time = gauss(average_service_time, stdev_service_time)
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list