@@ -1428,6 +1428,11 @@ msgid ""
14281428" client=\" John Cleese\" ,\n"
14291429" sketch=\" Cheese Shop Sketch\" )"
14301430msgstr ""
1431+ "cheeseshop(\" limburger\" , \" Jest bardzo płynny, proszę pana.\" ,\n"
1432+ " \" Naprawdę jest bardzo, BARDZO płynny, proszę pana.\" ,\n"
1433+ " shopkeeper=\" Michael Palin\" ,\n"
1434+ " client=\" John Cleese\" ,\n"
1435+ " sketch=\" Sklep z serami\" )"
14311436
14321437msgid "and of course it would print:"
14331438msgstr "i oczywiście wyświetli się nam:"
@@ -1442,6 +1447,14 @@ msgid ""
14421447"client : John Cleese\n"
14431448"sketch : Cheese Shop Sketch"
14441449msgstr ""
1450+ "-- Czy jest może limburger ?\n"
1451+ "-- Przykro mi, nie mamy już sera limburger\n"
1452+ "Jest bardzo płynny, proszę pana.\n"
1453+ "Naprawdę jest bardzo, BARDZO płynny, proszę pana.\n"
1454+ "----------------------------------------\n"
1455+ "shopkeeper : Michael Palin\n"
1456+ "client : John Cleese\n"
1457+ "sketch : Sklep z serami"
14451458
14461459msgid ""
14471460"Note that the order in which the keyword arguments are printed is guaranteed "
@@ -1479,6 +1492,12 @@ msgid ""
14791492" | - Keyword only\n"
14801493" -- Positional only"
14811494msgstr ""
1495+ "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):\n"
1496+ " ----------- ---------- ----------\n"
1497+ " | | |\n"
1498+ " | pozycyjny lub nazwany |\n"
1499+ " | - tylko nazwany\n"
1500+ " -- tylko pozycyjne"
14821501
14831502msgid ""
14841503"where ``/`` and ``*`` are optional. If used, these symbols indicate the kind "
@@ -1563,6 +1582,17 @@ msgid ""
15631582">>> def combined_example(pos_only, /, standard, *, kwd_only):\n"
15641583"... print(pos_only, standard, kwd_only)"
15651584msgstr ""
1585+ ">>> def standard_arg(arg):\n"
1586+ "... print(arg)\n"
1587+ "...\n"
1588+ ">>> def pos_only_arg(arg, /):\n"
1589+ "... print(arg)\n"
1590+ "...\n"
1591+ ">>> def kwd_only_arg(*, arg):\n"
1592+ "... print(arg)\n"
1593+ "...\n"
1594+ ">>> def combined_example(pos_only, /, standard, *, kwd_only):\n"
1595+ "... print(pos_only, standard, kwd_only)"
15661596
15671597msgid ""
15681598"The first function definition, ``standard_arg``, the most familiar form, "
@@ -1580,6 +1610,11 @@ msgid ""
15801610">>> standard_arg(arg=2)\n"
15811611"2"
15821612msgstr ""
1613+ ">>> standard_arg(2)\n"
1614+ "2\n"
1615+ "\n"
1616+ ">>> standard_arg(arg=2)\n"
1617+ "2"
15831618
15841619msgid ""
15851620"The second function ``pos_only_arg`` is restricted to only use positional "
@@ -1598,6 +1633,14 @@ msgid ""
15981633"TypeError: pos_only_arg() got some positional-only arguments passed as "
15991634"keyword arguments: 'arg'"
16001635msgstr ""
1636+ ">>> pos_only_arg(1)\n"
1637+ "1\n"
1638+ "\n"
1639+ ">>> pos_only_arg(arg=1)\n"
1640+ "Traceback (most recent call last):\n"
1641+ " File \" <stdin>\" , line 1, in <module>\n"
1642+ "TypeError: pos_only_arg() got some positional-only arguments passed as "
1643+ "keyword arguments: 'arg'"
16011644
16021645msgid ""
16031646"The third function ``kwd_only_args`` only allows keyword arguments as "
@@ -1615,6 +1658,13 @@ msgid ""
16151658">>> kwd_only_arg(arg=3)\n"
16161659"3"
16171660msgstr ""
1661+ ">>> kwd_only_arg(3)\n"
1662+ "Traceback (most recent call last):\n"
1663+ " File \" <stdin>\" , line 1, in <module>\n"
1664+ "TypeError: kwd_only_arg() takes 0 positional arguments but 1 was given\n"
1665+ "\n"
1666+ ">>> kwd_only_arg(arg=3)\n"
1667+ "3"
16181668
16191669msgid ""
16201670"And the last uses all three calling conventions in the same function "
@@ -1640,6 +1690,22 @@ msgid ""
16401690"TypeError: combined_example() got some positional-only arguments passed as "
16411691"keyword arguments: 'pos_only'"
16421692msgstr ""
1693+ ">>> combined_example(1, 2, 3)\n"
1694+ "Traceback (most recent call last):\n"
1695+ " File \" <stdin>\" , line 1, in <module>\n"
1696+ "TypeError: combined_example() takes 2 positional arguments but 3 were given\n"
1697+ "\n"
1698+ ">>> combined_example(1, 2, kwd_only=3)\n"
1699+ "1 2 3\n"
1700+ "\n"
1701+ ">>> combined_example(1, standard=2, kwd_only=3)\n"
1702+ "1 2 3\n"
1703+ "\n"
1704+ ">>> combined_example(pos_only=1, standard=2, kwd_only=3)\n"
1705+ "Traceback (most recent call last):\n"
1706+ " File \" <stdin>\" , line 1, in <module>\n"
1707+ "TypeError: combined_example() got some positional-only arguments passed as "
1708+ "keyword arguments: 'pos_only'"
16431709
16441710msgid ""
16451711"Finally, consider this function definition which has a potential collision "
@@ -1654,6 +1720,8 @@ msgid ""
16541720"def foo(name, **kwds):\n"
16551721" return 'name' in kwds"
16561722msgstr ""
1723+ "def foo(name, **kwds):\n"
1724+ " return 'name' in kwds"
16571725
16581726msgid ""
16591727"There is no possible call that will make it return ``True`` as the keyword "
@@ -1670,6 +1738,11 @@ msgid ""
16701738"TypeError: foo() got multiple values for argument 'name'\n"
16711739">>>"
16721740msgstr ""
1741+ ">>> foo(1, **{'name': 2})\n"
1742+ "Traceback (most recent call last):\n"
1743+ " File \" <stdin>\" , line 1, in <module>\n"
1744+ "TypeError: foo() got multiple values for argument 'name'\n"
1745+ ">>>"
16731746
16741747msgid ""
16751748"But using ``/`` (positional only arguments), it is possible since it allows "
@@ -1687,6 +1760,11 @@ msgid ""
16871760">>> foo(1, **{'name': 2})\n"
16881761"True"
16891762msgstr ""
1763+ ">>> def foo(name, /, **kwds):\n"
1764+ "... return 'name' in kwds\n"
1765+ "...\n"
1766+ ">>> foo(1, **{'name': 2})\n"
1767+ "True"
16901768
16911769msgid ""
16921770"In other words, the names of positional-only parameters can be used in "
@@ -1706,7 +1784,7 @@ msgstr ""
17061784"funkcji::"
17071785
17081786msgid "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):"
1709- msgstr ""
1787+ msgstr "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2): "
17101788
17111789msgid "As guidance:"
17121790msgstr "Kieruj się następującym:"
@@ -1758,6 +1836,8 @@ msgid ""
17581836"def write_multiple_items(file, separator, *args):\n"
17591837" file.write(separator.join(args))"
17601838msgstr ""
1839+ "def write_multiple_items(file, separator, *args):\n"
1840+ " file.write(separator.join(args))"
17611841
17621842msgid ""
17631843"Normally, these *variadic* arguments will be last in the list of formal "
@@ -1781,6 +1861,13 @@ msgid ""
17811861">>> concat(\" earth\" , \" mars\" , \" venus\" , sep=\" .\" )\n"
17821862"'earth.mars.venus'"
17831863msgstr ""
1864+ ">>> def concat(*args, sep=\" /\" ):\n"
1865+ "... return sep.join(args)\n"
1866+ "...\n"
1867+ ">>> concat(\" ziemia\" , \" mars\" , \" wenus\" )\n"
1868+ "'ziemia/mars/wenus'\n"
1869+ ">>> concat(\" ziemia\" , \" mars\" , \" wenus\" , sep=\" .\" )\n"
1870+ "'ziemia.mars.wenus'"
17841871
17851872msgid "Unpacking Argument Lists"
17861873msgstr "Rozpakowywanie listy argumentów"
@@ -1808,6 +1895,12 @@ msgid ""
18081895"list\n"
18091896"[3, 4, 5]"
18101897msgstr ""
1898+ ">>> list(range(3, 6)) # zwykłe wywołanie z osobnymi argumentami\n"
1899+ "[3, 4, 5]\n"
1900+ ">>> args = [3, 6]\n"
1901+ ">>> list(range(*args)) # wywołanie z argumentami rozpakowanymi z "
1902+ "listy\n"
1903+ "[3, 4, 5]"
18111904
18121905msgid ""
18131906"In the same fashion, dictionaries can deliver keyword arguments with the "
0 commit comments