@@ -12,7 +12,7 @@ msgid ""
1212msgstr ""
1313"Project-Id-Version : Python 3.14\n "
1414"Report-Msgid-Bugs-To : \n "
15- "POT-Creation-Date : 2026-02-19 14:43 +0000\n "
15+ "POT-Creation-Date : 2026-02-27 14:36 +0000\n "
1616"PO-Revision-Date : 2025-09-16 00:01+0000\n "
1717"Last-Translator : python-doc bot, 2026\n "
1818"Language-Team : Swedish (https://app.transifex.com/python-doc/teams/5390/ "
@@ -1643,131 +1643,9 @@ msgid ""
16431643"detect that the list has been mutated during a sort."
16441644msgstr ""
16451645
1646- msgid "Thread safety for list objects"
1647- msgstr ""
1648-
1649- msgid ""
1650- "Reading a single element from a :class:`list` is :term:`atomic <atomic "
1651- "operation>`:"
1652- msgstr ""
1653-
1654- msgid "lst[i] # list.__getitem__"
1655- msgstr ""
1656-
1657- msgid ""
1658- "The following methods traverse the list and use :term:`atomic <atomic "
1659- "operation>` reads of each item to perform their function. That means that "
1660- "they may return results affected by concurrent modifications:"
1661- msgstr ""
1662-
1663- msgid ""
1664- "item in lst\n"
1665- "lst.index(item)\n"
1666- "lst.count(item)"
1667- msgstr ""
1668-
1669- msgid ""
1670- "All of the above operations avoid acquiring :term:`per-object locks <per-"
1671- "object lock>`. They do not block concurrent modifications. Other operations "
1672- "that hold a lock will not block these from observing intermediate states."
1673- msgstr ""
1674-
1675- msgid ""
1676- "All other operations from here on block using the :term:`per-object lock`."
1677- msgstr ""
1678-
1679- msgid ""
1680- "Writing a single item via ``lst[i] = x`` is safe to call from multiple "
1681- "threads and will not corrupt the list."
1682- msgstr ""
1683-
1684- msgid ""
1685- "The following operations return new objects and appear :term:`atomic <atomic "
1686- "operation>` to other threads:"
1687- msgstr ""
1688-
1689- msgid ""
1690- "lst1 + lst2 # concatenates two lists into a new list\n"
1691- "x * lst # repeats lst x times into a new list\n"
1692- "lst.copy() # returns a shallow copy of the list"
1693- msgstr ""
1694-
16951646msgid ""
1696- "The following methods that only operate on a single element with no shifting "
1697- "required are :term:`atomic <atomic operation>`:"
1698- msgstr ""
1699-
1700- msgid ""
1701- "lst.append(x) # append to the end of the list, no shifting required\n"
1702- "lst.pop() # pop element from the end of the list, no shifting required"
1703- msgstr ""
1704-
1705- msgid ""
1706- "The :meth:`~list.clear` method is also :term:`atomic <atomic operation>`. "
1707- "Other threads cannot observe elements being removed."
1708- msgstr ""
1709-
1710- msgid ""
1711- "The :meth:`~list.sort` method is not :term:`atomic <atomic operation>`. "
1712- "Other threads cannot observe intermediate states during sorting, but the "
1713- "list appears empty for the duration of the sort."
1714- msgstr ""
1715-
1716- msgid ""
1717- "The following operations may allow :term:`lock-free` operations to observe "
1718- "intermediate states since they modify multiple elements in place:"
1719- msgstr ""
1720-
1721- msgid ""
1722- "lst.insert(idx, item) # shifts elements\n"
1723- "lst.pop(idx) # idx not at the end of the list, shifts elements\n"
1724- "lst *= x # copies elements in place"
1725- msgstr ""
1726-
1727- msgid ""
1728- "The :meth:`~list.remove` method may allow concurrent modifications since "
1729- "element comparison may execute arbitrary Python code (via :meth:`~object."
1730- "__eq__`)."
1731- msgstr ""
1732-
1733- msgid ""
1734- ":meth:`~list.extend` is safe to call from multiple threads. However, its "
1735- "guarantees depend on the iterable passed to it. If it is a :class:`list`, a :"
1736- "class:`tuple`, a :class:`set`, a :class:`frozenset`, a :class:`dict` or a :"
1737- "ref:`dictionary view object <dict-views>` (but not their subclasses), the "
1738- "``extend`` operation is safe from concurrent modifications to the iterable. "
1739- "Otherwise, an iterator is created which can be concurrently modified by "
1740- "another thread. The same applies to inplace concatenation of a list with "
1741- "other iterables when using ``lst += iterable``."
1742- msgstr ""
1743-
1744- msgid ""
1745- "Similarly, assigning to a list slice with ``lst[i:j] = iterable`` is safe to "
1746- "call from multiple threads, but ``iterable`` is only locked when it is also "
1747- "a :class:`list` (but not its subclasses)."
1748- msgstr ""
1749-
1750- msgid ""
1751- "Operations that involve multiple accesses, as well as iteration, are never "
1752- "atomic. For example:"
1753- msgstr ""
1754-
1755- msgid ""
1756- "# NOT atomic: read-modify-write\n"
1757- "lst[i] = lst[i] + 1\n"
1758- "\n"
1759- "# NOT atomic: check-then-act\n"
1760- "if lst:\n"
1761- " item = lst.pop()\n"
1762- "\n"
1763- "# NOT thread-safe: iteration while modifying\n"
1764- "for item in lst:\n"
1765- " process(item) # another thread may modify lst"
1766- msgstr ""
1767-
1768- msgid ""
1769- "Consider external synchronization when sharing :class:`list` instances "
1770- "across threads. See :ref:`freethreading-python-howto` for more information."
1647+ "For detailed information on thread-safety guarantees for :class:`list` "
1648+ "objects, see :ref:`thread-safety-list`."
17711649msgstr ""
17721650
17731651msgid "Tuples"
@@ -3008,6 +2886,18 @@ msgid ""
30082886"original string is returned if *width* is less than or equal to ``len(s)``."
30092887msgstr ""
30102888
2889+ msgid ""
2890+ ">>> 'Python'.rjust(10)\n"
2891+ "' Python'\n"
2892+ ">>> 'Python'.rjust(10, '.')\n"
2893+ "'....Python'\n"
2894+ ">>> 'Monty Python'.rjust(10, '.')\n"
2895+ "'Monty Python'"
2896+ msgstr ""
2897+
2898+ msgid "See also :meth:`ljust` and :meth:`zfill`."
2899+ msgstr ""
2900+
30112901msgid ""
30122902"Split the string at the last occurrence of *sep*, and return a 3-tuple "
30132903"containing the part before the separator, the separator itself, and the part "
@@ -5916,161 +5806,9 @@ msgid ""
59165806"class:`dict`."
59175807msgstr ""
59185808
5919- msgid "Thread safety for dict objects"
5920- msgstr ""
5921-
5922- msgid ""
5923- "Creating a dictionary with the :class:`dict` constructor is atomic when the "
5924- "argument to it is a :class:`dict` or a :class:`tuple`. When using the :meth:"
5925- "`dict.fromkeys` method, dictionary creation is atomic when the argument is "
5926- "a :class:`dict`, :class:`tuple`, :class:`set` or :class:`frozenset`."
5927- msgstr ""
5928-
5929- msgid ""
5930- "The following operations and functions are :term:`lock-free` and :term:"
5931- "`atomic <atomic operation>`."
5932- msgstr ""
5933-
5934- msgid ""
5935- "d[key] # dict.__getitem__\n"
5936- "d.get(key) # dict.get\n"
5937- "key in d # dict.__contains__\n"
5938- "len(d) # dict.__len__"
5939- msgstr ""
5940-
5941- msgid "All other operations from here on hold the :term:`per-object lock`."
5942- msgstr ""
5943-
5944- msgid ""
5945- "Writing or removing a single item is safe to call from multiple threads and "
5946- "will not corrupt the dictionary:"
5947- msgstr ""
5948-
5949- msgid ""
5950- "d[key] = value # write\n"
5951- "del d[key] # delete\n"
5952- "d.pop(key) # remove and return\n"
5953- "d.popitem() # remove and return last item\n"
5954- "d.setdefault(key, v) # insert if missing"
5955- msgstr ""
5956-
5957- msgid ""
5958- "These operations may compare keys using :meth:`~object.__eq__`, which can "
5959- "execute arbitrary Python code. During such comparisons, the dictionary may "
5960- "be modified by another thread. For built-in types like :class:`str`, :class:"
5961- "`int`, and :class:`float`, that implement :meth:`~object.__eq__` in C, the "
5962- "underlying lock is not released during comparisons and this is not a concern."
5963- msgstr ""
5964-
5965- msgid ""
5966- "The following operations return new objects and hold the :term:`per-object "
5967- "lock` for the duration of the operation:"
5968- msgstr ""
5969-
5970- msgid ""
5971- "d.copy() # returns a shallow copy of the dictionary\n"
5972- "d | other # merges two dicts into a new dict\n"
5973- "d.keys() # returns a new dict_keys view object\n"
5974- "d.values() # returns a new dict_values view object\n"
5975- "d.items() # returns a new dict_items view object"
5976- msgstr ""
5977-
5978- msgid ""
5979- "The :meth:`~dict.clear` method holds the lock for its duration. Other "
5980- "threads cannot observe elements being removed."
5981- msgstr ""
5982-
5983- msgid ""
5984- "The following operations lock both dictionaries. For :meth:`~dict.update` "
5985- "and ``|=``, this applies only when the other operand is a :class:`dict` that "
5986- "uses the standard dict iterator (but not subclasses that override "
5987- "iteration). For equality comparison, this applies to :class:`dict` and its "
5988- "subclasses:"
5989- msgstr ""
5990-
5991- msgid ""
5992- "d.update(other_dict) # both locked when other_dict is a dict\n"
5993- "d |= other_dict # both locked when other_dict is a dict\n"
5994- "d == other_dict # both locked for dict and subclasses"
5995- msgstr ""
5996-
5997- msgid ""
5998- "All comparison operations also compare values using :meth:`~object.__eq__`, "
5999- "so for non-built-in types the lock may be released during comparison."
6000- msgstr ""
6001-
6002- msgid ""
6003- ":meth:`~dict.fromkeys` locks both the new dictionary and the iterable when "
6004- "the iterable is exactly a :class:`dict`, :class:`set`, or :class:`frozenset` "
6005- "(not subclasses):"
6006- msgstr ""
6007-
6008- msgid ""
6009- "dict.fromkeys(a_dict) # locks both\n"
6010- "dict.fromkeys(a_set) # locks both\n"
6011- "dict.fromkeys(a_frozenset) # locks both"
6012- msgstr ""
6013-
6014- msgid ""
6015- "When updating from a non-dict iterable, only the target dictionary is "
6016- "locked. The iterable may be concurrently modified by another thread:"
6017- msgstr ""
6018-
6019- msgid ""
6020- "d.update(iterable) # iterable is not a dict: only d locked\n"
6021- "d |= iterable # iterable is not a dict: only d locked\n"
6022- "dict.fromkeys(iterable) # iterable is not a dict/set/frozenset: only "
6023- "result locked"
6024- msgstr ""
6025-
6026- msgid ""
6027- "Operations that involve multiple accesses, as well as iteration, are never "
6028- "atomic:"
6029- msgstr ""
6030-
6031- msgid ""
6032- "# NOT atomic: read-modify-write\n"
6033- "d[key] = d[key] + 1\n"
6034- "\n"
6035- "# NOT atomic: check-then-act (TOCTOU)\n"
6036- "if key in d:\n"
6037- " del d[key]\n"
6038- "\n"
6039- "# NOT thread-safe: iteration while modifying\n"
6040- "for key, value in d.items():\n"
6041- " process(key) # another thread may modify d"
6042- msgstr ""
6043-
6044- msgid ""
6045- "To avoid time-of-check to time-of-use (TOCTOU) issues, use atomic operations "
6046- "or handle exceptions:"
6047- msgstr ""
6048-
6049- msgid ""
6050- "# Use pop() with default instead of check-then-delete\n"
6051- "d.pop(key, None)\n"
6052- "\n"
6053- "# Or handle the exception\n"
6054- "try:\n"
6055- " del d[key]\n"
6056- "except KeyError:\n"
6057- " pass"
6058- msgstr ""
6059-
6060- msgid ""
6061- "To safely iterate over a dictionary that may be modified by another thread, "
6062- "iterate over a copy:"
6063- msgstr ""
6064-
6065- msgid ""
6066- "# Make a copy to iterate safely\n"
6067- "for key, value in d.copy().items():\n"
6068- " process(key)"
6069- msgstr ""
6070-
60715809msgid ""
6072- "Consider external synchronization when sharing :class:`dict` instances "
6073- "across threads. See :ref:`freethreading-python-howto` for more information ."
5810+ "For detailed information on thread-safety guarantees for :class:`dict` "
5811+ "objects, see :ref:`thread-safety-dict` ."
60745812msgstr ""
60755813
60765814msgid "Dictionary view objects"
0 commit comments