@@ -11,7 +11,7 @@ msgid ""
1111msgstr ""
1212"Project-Id-Version : Python 3.12\n "
1313"Report-Msgid-Bugs-To : \n "
14- "POT-Creation-Date : 2023-05-26 14:12 +0000\n "
14+ "POT-Creation-Date : 2023-05-29 16:50 +0000\n "
1515"PO-Revision-Date : 2021-06-28 01:19+0000\n "
1616"
Last-Translator :
Maciej Olko <[email protected] >, 2023\n "
1717"Language-Team : Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n "
@@ -1159,6 +1159,18 @@ msgid ""
11591159"see :pep:`614` for details."
11601160msgstr ""
11611161
1162+ msgid ""
1163+ "A list of :ref:`type parameters <type-params>` may be given in square "
1164+ "brackets between the function's name and the opening parenthesis for its "
1165+ "parameter list. This indicates to static type checkers that the function is "
1166+ "generic. At runtime, the type parameters can be retrieved from the "
1167+ "function's ``__type_params__`` attribute. See :ref:`generic-functions` for "
1168+ "more."
1169+ msgstr ""
1170+
1171+ msgid "Type parameter lists are new in Python 3.12."
1172+ msgstr ""
1173+
11621174msgid ""
11631175"When one or more :term:`parameters <parameter>` have the form *parameter* "
11641176"``=`` *expression*, the function is said to have \" default parameter values."
@@ -1318,6 +1330,14 @@ msgid ""
13181330"see :pep:`614` for details."
13191331msgstr ""
13201332
1333+ msgid ""
1334+ "A list of :ref:`type parameters <type-params>` may be given in square "
1335+ "brackets immediately after the class's name. This indicates to static type "
1336+ "checkers that the class is generic. At runtime, the type parameters can be "
1337+ "retrieved from the class's ``__type_params__`` attribute. See :ref:`generic-"
1338+ "classes` for more."
1339+ msgstr ""
1340+
13211341msgid ""
13221342"**Programmer's note:** Variables defined in the class definition are class "
13231343"attributes; they are shared by instances. Instance attributes can be set in "
@@ -1429,6 +1449,166 @@ msgid ""
14291449"added supporting syntax."
14301450msgstr ""
14311451
1452+ msgid "Type parameter lists"
1453+ msgstr ""
1454+
1455+ msgid ""
1456+ ":ref:`Functions <def>` (including :ref:`coroutines <async def>`), :ref:"
1457+ "`classes <class>` and :ref:`type aliases <type>` may contain a type "
1458+ "parameter list::"
1459+ msgstr ""
1460+
1461+ msgid ""
1462+ "Semantically, this indicates that the function, class, or type alias is "
1463+ "generic over a type variable. This information is primarily used by static "
1464+ "type checkers, and at runtime, generic objects behave much like their non-"
1465+ "generic counterparts."
1466+ msgstr ""
1467+
1468+ msgid ""
1469+ "Type parameters are declared in square brackets (``[]``) immediately after "
1470+ "the name of the function, class, or type alias. The type parameters are "
1471+ "accessible within the scope of the generic object, but not elsewhere. Thus, "
1472+ "after a declaration ``def func[T](): pass``, the name ``T`` is not available "
1473+ "in the module scope. Below, the semantics of generic objects are described "
1474+ "with more precision. The scope of type parameters is modeled with a special "
1475+ "function (technically, an :ref:`annotation scope <annotation-scopes>`) that "
1476+ "wraps the creation of the generic object."
1477+ msgstr ""
1478+
1479+ msgid ""
1480+ "Generic functions, classes, and type aliases have a :attr:`!__type_params__` "
1481+ "attribute listing their type parameters."
1482+ msgstr ""
1483+
1484+ msgid "Type parameters come in three kinds:"
1485+ msgstr ""
1486+
1487+ msgid ""
1488+ ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). "
1489+ "Semantically, this represents a single type to a type checker."
1490+ msgstr ""
1491+
1492+ msgid ""
1493+ ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single "
1494+ "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any "
1495+ "number of types."
1496+ msgstr ""
1497+
1498+ msgid ""
1499+ ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks "
1500+ "(e.g., ``**P``). Semantically, this stands for the parameters of a callable."
1501+ msgstr ""
1502+
1503+ msgid ""
1504+ ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* "
1505+ "with a colon (``:``) followed by an expression. A single expression after "
1506+ "the colon indicates a bound (e.g. ``T: int``). Semantically, this means that "
1507+ "the :data:`!typing.TypeVar` can only represent types that are a subtype of "
1508+ "this bound. A parenthesized tuple of expressions after the colon indicates a "
1509+ "set of constraints (e.g. ``T: (str, bytes)``). Each member of the tuple "
1510+ "should be a type (again, this is not enforced at runtime). Constrained type "
1511+ "variables can only take on one of the types in the list of constraints."
1512+ msgstr ""
1513+
1514+ msgid ""
1515+ "For :data:`!typing.TypeVar`\\ s declared using the type parameter list "
1516+ "syntax, the bound and constraints are not evaluated when the generic object "
1517+ "is created, but only when the value is explicitly accessed through the "
1518+ "attributes ``__bound__`` and ``__constraints__``. To accomplish this, the "
1519+ "bounds or constraints are evaluated in a separate :ref:`annotation scope "
1520+ "<annotation-scopes>`."
1521+ msgstr ""
1522+
1523+ msgid ""
1524+ ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have "
1525+ "bounds or constraints."
1526+ msgstr ""
1527+
1528+ msgid ""
1529+ "The following example indicates the full set of allowed type parameter "
1530+ "declarations::"
1531+ msgstr ""
1532+
1533+ msgid "Generic functions"
1534+ msgstr ""
1535+
1536+ msgid "Generic functions are declared as follows::"
1537+ msgstr ""
1538+
1539+ msgid "This syntax is equivalent to::"
1540+ msgstr ""
1541+
1542+ msgid ""
1543+ "Here ``annotation-def`` indicates an :ref:`annotation scope <annotation-"
1544+ "scopes>`, which is not actually bound to any name at runtime. (One other "
1545+ "liberty is taken in the translation: the syntax does not go through "
1546+ "attribute access on the :mod:`typing` module, but creates an instance of :"
1547+ "data:`typing.TypeVar` directly.)"
1548+ msgstr ""
1549+
1550+ msgid ""
1551+ "The annotations of generic functions are evaluated within the annotation "
1552+ "scope used for declaring the type parameters, but the function's defaults "
1553+ "and decorators are not."
1554+ msgstr ""
1555+
1556+ msgid ""
1557+ "The following example illustrates the scoping rules for these cases, as well "
1558+ "as for additional flavors of type parameters::"
1559+ msgstr ""
1560+
1561+ msgid ""
1562+ "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the :class:"
1563+ "`~typing.TypeVar` bound, this is equivalent to::"
1564+ msgstr ""
1565+
1566+ msgid ""
1567+ "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at "
1568+ "runtime."
1569+ msgstr ""
1570+
1571+ msgid "Generic classes"
1572+ msgstr ""
1573+
1574+ msgid "Generic classes are declared as follows::"
1575+ msgstr ""
1576+
1577+ msgid ""
1578+ "Here again ``annotation-def`` (not a real keyword) indicates an :ref:"
1579+ "`annotation scope <annotation-scopes>`, and the name ``TYPE_PARAMS_OF_Bag`` "
1580+ "is not actually bound at runtime."
1581+ msgstr ""
1582+
1583+ msgid ""
1584+ "Generic classes implicitly inherit from :data:`typing.Generic`. The base "
1585+ "classes and keyword arguments of generic classes are evaluated within the "
1586+ "type scope for the type parameters, and decorators are evaluated outside "
1587+ "that scope. This is illustrated by this example::"
1588+ msgstr ""
1589+
1590+ msgid "This is equivalent to::"
1591+ msgstr ""
1592+
1593+ msgid "Generic type aliases"
1594+ msgstr ""
1595+
1596+ msgid ""
1597+ "The :keyword:`type` statement can also be used to create a generic type "
1598+ "alias::"
1599+ msgstr ""
1600+
1601+ msgid ""
1602+ "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the value, this "
1603+ "is equivalent to::"
1604+ msgstr ""
1605+
1606+ msgid ""
1607+ "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation "
1608+ "scope <annotation-scopes>`. The capitalized names like "
1609+ "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime."
1610+ msgstr ""
1611+
14321612msgid "Footnotes"
14331613msgstr "Przypisy"
14341614
@@ -1754,3 +1934,6 @@ msgstr ""
17541934
17551935msgid "async with"
17561936msgstr ""
1937+
1938+ msgid "type parameters"
1939+ msgstr ""
0 commit comments