Skip to contentSkip to conversation

btt_plot.py: Use sum() instead of open-coding it to compute list average

PATCH New Vincent Legoll 1 participant 1 message Mar 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/10 btt_plot.py: Use sum() instead of open-coding it to compute list average

---
 btt/btt_plot.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
btt/btt_plot.py +1 -4
index 76fcca8..9c6f207 100755
@@ -125,10 +125,7 @@ def get_data(files):
 		def _avg(vals):
 			"""Computes average for array of values passed"""
 
-			total = 0.0
-			for val in vals:
-				total += val
-			return total / len(vals)
+			return sum(vals) / len(vals)
 
 		#------------------------------------------------------
 		if len(xs) < 1000:
Signature · 1 line
2.20.1