@@ -11,7 +11,7 @@ msgid ""
1111msgstr ""
1212"Project-Id-Version : Python 3.14\n "
1313"Report-Msgid-Bugs-To : \n "
14- "POT-Creation-Date : 2026-04-09 15:16 +0000\n "
14+ "POT-Creation-Date : 2026-04-25 14:38 +0000\n "
1515"PO-Revision-Date : 2025-09-16 00:01+0000\n "
1616"Last-Translator : python-doc bot, 2025\n "
1717"Language-Team : Indonesian (https://app.transifex.com/python-doc/teams/5390/ "
@@ -1144,6 +1144,7 @@ msgid ""
11441144"from collections import Counter, deque\n"
11451145"from contextlib import suppress\n"
11461146"from functools import reduce\n"
1147+ "from heapq import heappush, heappushpop, heappush_max, heappushpop_max\n"
11471148"from math import comb, isqrt, prod, sumprod\n"
11481149"from operator import getitem, is_not, itemgetter, mul, neg, truediv\n"
11491150"\n"
@@ -1159,11 +1160,6 @@ msgid ""
11591160" # prepend(1, [2, 3, 4]) → 1 2 3 4\n"
11601161" return chain([value], iterable)\n"
11611162"\n"
1162- "def running_mean(iterable):\n"
1163- " \" Yield the average of all values seen so far.\" \n"
1164- " # running_mean([8.5, 9.5, 7.5, 6.5]) → 8.5 9.0 8.5 8.0\n"
1165- " return map(truediv, accumulate(iterable), count(1))\n"
1166- "\n"
11671163"def repeatfunc(function, times=None, *args):\n"
11681164" \" Repeat calls to a function with specified arguments.\" \n"
11691165" if times is None:\n"
@@ -1463,5 +1459,48 @@ msgid ""
14631459" # totient(12) → 4 because len([1, 5, 7, 11]) == 4\n"
14641460" for prime in set(factor(n)):\n"
14651461" n -= n // prime\n"
1466- " return n"
1462+ " return n\n"
1463+ "\n"
1464+ "\n"
1465+ "# ==== Running statistics ====\n"
1466+ "\n"
1467+ "def running_mean(iterable):\n"
1468+ " \" Average of values seen so far.\" \n"
1469+ " # running_mean([37, 33, 38, 28]) → 37 35 36 34\n"
1470+ " return map(truediv, accumulate(iterable), count(1))\n"
1471+ "\n"
1472+ "def running_min(iterable):\n"
1473+ " \" Smallest of values seen so far.\" \n"
1474+ " # running_min([37, 33, 38, 28]) → 37 33 33 28\n"
1475+ " return accumulate(iterable, func=min)\n"
1476+ "\n"
1477+ "def running_max(iterable):\n"
1478+ " \" Largest of values seen so far.\" \n"
1479+ " # running_max([37, 33, 38, 28]) → 37 37 38 38\n"
1480+ " return accumulate(iterable, func=max)\n"
1481+ "\n"
1482+ "def running_median(iterable):\n"
1483+ " \" Median of values seen so far.\" \n"
1484+ " # running_median([37, 33, 38, 28]) → 37 35 37 35\n"
1485+ " read = iter(iterable).__next__\n"
1486+ " lo = [] # max-heap\n"
1487+ " hi = [] # min-heap the same size as or one smaller than lo\n"
1488+ " with suppress(StopIteration):\n"
1489+ " while True:\n"
1490+ " heappush_max(lo, heappushpop(hi, read()))\n"
1491+ " yield lo[0]\n"
1492+ " heappush(hi, heappushpop_max(lo, read()))\n"
1493+ " yield (lo[0] + hi[0]) / 2\n"
1494+ "\n"
1495+ "def running_statistics(iterable):\n"
1496+ " \" Aggregate statistics for values seen so far.\" \n"
1497+ " # Generate tuples: (size, minimum, median, maximum, mean)\n"
1498+ " t0, t1, t2, t3 = tee(iterable, 4)\n"
1499+ " return zip(\n"
1500+ " count(1),\n"
1501+ " running_min(t0),\n"
1502+ " running_median(t1),\n"
1503+ " running_max(t2),\n"
1504+ " running_mean(t3),\n"
1505+ " )"
14671506msgstr ""
0 commit comments