summaryrefslogtreecommitdiff
path: root/Lib/statistics.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/statistics.py')
-rw-r--r--Lib/statistics.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/statistics.py b/Lib/statistics.py
index 012845b8d2..5be70e5ebf 100644
--- a/Lib/statistics.py
+++ b/Lib/statistics.py
@@ -320,11 +320,11 @@ def fmean(data):
except TypeError:
# Handle iterators that do not define __len__().
n = 0
- def count(x):
+ def count(iterable):
nonlocal n
- n += 1
- return x
- total = fsum(map(count, data))
+ for n, x in enumerate(iterable, start=1):
+ yield x
+ total = fsum(count(data))
else:
total = fsum(data)
try: