@@ -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 : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
@@ -1409,6 +1409,7 @@ msgid ""
14091409"from collections import Counter, deque\n"
14101410"from contextlib import suppress\n"
14111411"from functools import reduce\n"
1412+ "from heapq import heappush, heappushpop, heappush_max, heappushpop_max\n"
14121413"from math import comb, isqrt, prod, sumprod\n"
14131414"from operator import getitem, is_not, itemgetter, mul, neg, truediv\n"
14141415"\n"
@@ -1424,11 +1425,6 @@ msgid ""
14241425" # prepend(1, [2, 3, 4]) → 1 2 3 4\n"
14251426" return chain([value], iterable)\n"
14261427"\n"
1427- "def running_mean(iterable):\n"
1428- " \" Yield the average of all values seen so far.\" \n"
1429- " # running_mean([8.5, 9.5, 7.5, 6.5]) → 8.5 9.0 8.5 8.0\n"
1430- " return map(truediv, accumulate(iterable), count(1))\n"
1431- "\n"
14321428"def repeatfunc(function, times=None, *args):\n"
14331429" \" Repeat calls to a function with specified arguments.\" \n"
14341430" if times is None:\n"
@@ -1728,5 +1724,48 @@ msgid ""
17281724" # totient(12) → 4 because len([1, 5, 7, 11]) == 4\n"
17291725" for prime in set(factor(n)):\n"
17301726" n -= n // prime\n"
1731- " return n"
1727+ " return n\n"
1728+ "\n"
1729+ "\n"
1730+ "# ==== Running statistics ====\n"
1731+ "\n"
1732+ "def running_mean(iterable):\n"
1733+ " \" Average of values seen so far.\" \n"
1734+ " # running_mean([37, 33, 38, 28]) → 37 35 36 34\n"
1735+ " return map(truediv, accumulate(iterable), count(1))\n"
1736+ "\n"
1737+ "def running_min(iterable):\n"
1738+ " \" Smallest of values seen so far.\" \n"
1739+ " # running_min([37, 33, 38, 28]) → 37 33 33 28\n"
1740+ " return accumulate(iterable, func=min)\n"
1741+ "\n"
1742+ "def running_max(iterable):\n"
1743+ " \" Largest of values seen so far.\" \n"
1744+ " # running_max([37, 33, 38, 28]) → 37 37 38 38\n"
1745+ " return accumulate(iterable, func=max)\n"
1746+ "\n"
1747+ "def running_median(iterable):\n"
1748+ " \" Median of values seen so far.\" \n"
1749+ " # running_median([37, 33, 38, 28]) → 37 35 37 35\n"
1750+ " read = iter(iterable).__next__\n"
1751+ " lo = [] # max-heap\n"
1752+ " hi = [] # min-heap the same size as or one smaller than lo\n"
1753+ " with suppress(StopIteration):\n"
1754+ " while True:\n"
1755+ " heappush_max(lo, heappushpop(hi, read()))\n"
1756+ " yield lo[0]\n"
1757+ " heappush(hi, heappushpop_max(lo, read()))\n"
1758+ " yield (lo[0] + hi[0]) / 2\n"
1759+ "\n"
1760+ "def running_statistics(iterable):\n"
1761+ " \" Aggregate statistics for values seen so far.\" \n"
1762+ " # Generate tuples: (size, minimum, median, maximum, mean)\n"
1763+ " t0, t1, t2, t3 = tee(iterable, 4)\n"
1764+ " return zip(\n"
1765+ " count(1),\n"
1766+ " running_min(t0),\n"
1767+ " running_median(t1),\n"
1768+ " running_max(t2),\n"
1769+ " running_mean(t3),\n"
1770+ " )"
17321771msgstr ""
0 commit comments