| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent de238e6 commit e9cb044
18 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,7 +16,7 @@ f'''[](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) | |
| 17 | 17 | [](https://translations.python.org/#pl) | |
| 18 | 18 | [](https://translations.python.org/#pl) | |
| 19 | - [](https://translations.python.org/#pl) | ||
| 19 | + [](https://translations.python.org/#pl) | ||
| 20 | 20 | <!-- [[[end]]] --> | |
| 21 | 21 | ||
| 22 | 22 | *Przeczytaj to w innym języku: [polski](README.md)* | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,7 +16,7 @@ f'''[](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) | |
| 17 | 17 | [](https://translations.python.org/#pl) | |
| 18 | 18 | [](https://translations.python.org/#pl) | |
| 19 | - [](https://translations.python.org/#pl) | ||
| 19 | + [](https://translations.python.org/#pl) | ||
| 20 | 20 | <!-- [[[end]]] --> | |
| 21 | 21 | ||
| 22 | 22 | *Read this in another language: [English](README.en.md)* | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ msgid "" | |||
| 11 | 11 | msgstr "" | |
| 12 | 12 | "Project-Id-Version: Python 3.14\n" | |
| 13 | 13 | "Report-Msgid-Bugs-To: \n" | |
| 14 | - "POT-Creation-Date: 2025-11-13 18:32+0000\n" | ||
| 14 | + "POT-Creation-Date: 2025-12-03 14:17+0000\n" | ||
| 15 | 15 | "PO-Revision-Date: 2025-09-16 00:00+0000\n" | |
| 16 | 16 | "Last-Translator: python-doc bot, 2025\n" | |
| 17 | 17 | "Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ msgid "" | |||
| 11 | 11 | msgstr "" | |
| 12 | 12 | "Project-Id-Version: Python 3.14\n" | |
| 13 | 13 | "Report-Msgid-Bugs-To: \n" | |
| 14 | - "POT-Creation-Date: 2025-11-13 18:32+0000\n" | ||
| 14 | + "POT-Creation-Date: 2025-12-03 14:17+0000\n" | ||
| 15 | 15 | "PO-Revision-Date: 2025-09-16 00:00+0000\n" | |
| 16 | 16 | "Last-Translator: python-doc bot, 2025\n" | |
| 17 | 17 | "Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ msgid "" | |||
| 11 | 11 | msgstr "" | |
| 12 | 12 | "Project-Id-Version: Python 3.14\n" | |
| 13 | 13 | "Report-Msgid-Bugs-To: \n" | |
| 14 | - "POT-Creation-Date: 2025-11-13 18:32+0000\n" | ||
| 14 | + "POT-Creation-Date: 2025-12-03 14:17+0000\n" | ||
| 15 | 15 | "PO-Revision-Date: 2025-09-16 00:00+0000\n" | |
| 16 | 16 | "Last-Translator: python-doc bot, 2025\n" | |
| 17 | 17 | "Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ msgid "" | |||
| 11 | 11 | msgstr "" | |
| 12 | 12 | "Project-Id-Version: Python 3.14\n" | |
| 13 | 13 | "Report-Msgid-Bugs-To: \n" | |
| 14 | - "POT-Creation-Date: 2025-11-15 14:12+0000\n" | ||
| 14 | + "POT-Creation-Date: 2025-12-05 14:15+0000\n" | ||
| 15 | 15 | "PO-Revision-Date: 2025-09-16 00:00+0000\n" | |
| 16 | 16 | "Last-Translator: python-doc bot, 2025\n" | |
| 17 | 17 | "Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ msgid "" | |||
| 11 | 11 | msgstr "" | |
| 12 | 12 | "Project-Id-Version: Python 3.14\n" | |
| 13 | 13 | "Report-Msgid-Bugs-To: \n" | |
| 14 | - "POT-Creation-Date: 2025-11-13 18:32+0000\n" | ||
| 14 | + "POT-Creation-Date: 2025-12-03 14:17+0000\n" | ||
| 15 | 15 | "PO-Revision-Date: 2025-09-16 00:00+0000\n" | |
| 16 | 16 | "Last-Translator: python-doc bot, 2025\n" | |
| 17 | 17 | "Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ msgid "" | |||
| 11 | 11 | msgstr "" | |
| 12 | 12 | "Project-Id-Version: Python 3.14\n" | |
| 13 | 13 | "Report-Msgid-Bugs-To: \n" | |
| 14 | - "POT-Creation-Date: 2025-11-13 18:32+0000\n" | ||
| 14 | + "POT-Creation-Date: 2025-12-03 14:17+0000\n" | ||
| 15 | 15 | "PO-Revision-Date: 2025-09-16 00:00+0000\n" | |
| 16 | 16 | "Last-Translator: python-doc bot, 2025\n" | |
| 17 | 17 | "Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ msgid "" | |||
| 11 | 11 | msgstr "" | |
| 12 | 12 | "Project-Id-Version: Python 3.14\n" | |
| 13 | 13 | "Report-Msgid-Bugs-To: \n" | |
| 14 | - "POT-Creation-Date: 2025-11-13 18:32+0000\n" | ||
| 14 | + "POT-Creation-Date: 2025-12-03 14:17+0000\n" | ||
| 15 | 15 | "PO-Revision-Date: 2025-09-16 00:00+0000\n" | |
| 16 | 16 | "Last-Translator: python-doc bot, 2025\n" | |
| 17 | 17 | "Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ msgid "" | |||
| 11 | 11 | msgstr "" | |
| 12 | 12 | "Project-Id-Version: Python 3.14\n" | |
| 13 | 13 | "Report-Msgid-Bugs-To: \n" | |
| 14 | - "POT-Creation-Date: 2025-12-01 14:16+0000\n" | ||
| 14 | + "POT-Creation-Date: 2025-12-05 14:15+0000\n" | ||
| 15 | 15 | "PO-Revision-Date: 2025-09-16 00:01+0000\n" | |
| 16 | 16 | "Last-Translator: python-doc bot, 2025\n" | |
| 17 | 17 | "Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n" | |
@@ -3187,7 +3187,7 @@ msgid "" | |||
| 3187 | 3187 | "within f-strings." | |
| 3188 | 3188 | msgstr "" | |
| 3189 | 3189 | ||
| 3190 | - msgid "Added the debugging operator (``=``)" | ||
| 3190 | + msgid "Added the debug specifier (``=``)" | ||
| 3191 | 3191 | msgstr "" | |
| 3192 | 3192 | ||
| 3193 | 3193 | msgid "" | |
@@ -3198,137 +3198,175 @@ msgstr "" | |||
| 3198 | 3198 | msgid "" | |
| 3199 | 3199 | "An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " | |
| 3200 | 3200 | "literal that is prefixed with ``f`` or ``F``. This type of string literal " | |
| 3201 | - "allows embedding arbitrary Python expressions within *replacement fields*, " | ||
| 3202 | - "which are delimited by curly brackets (``{}``). These expressions are " | ||
| 3203 | - "evaluated at runtime, similarly to :meth:`str.format`, and are converted " | ||
| 3204 | - "into regular :class:`str` objects. For example:" | ||
| 3201 | + "allows embedding the results of arbitrary Python expressions within " | ||
| 3202 | + "*replacement fields*, which are delimited by curly brackets (``{}``). Each " | ||
| 3203 | + "replacement field must contain an expression, optionally followed by:" | ||
| 3205 | 3204 | msgstr "" | |
| 3206 | 3205 | ||
| 3207 | - msgid "" | ||
| 3208 | - ">>> who = 'nobody'\n" | ||
| 3209 | - ">>> nationality = 'Spanish'\n" | ||
| 3210 | - ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" | ||
| 3211 | - "'Nobody expects the Spanish Inquisition!'" | ||
| 3206 | + msgid "a *debug specifier* -- an equal sign (``=``);" | ||
| 3212 | 3207 | msgstr "" | |
| 3213 | 3208 | ||
| 3214 | - msgid "It is also possible to use a multi line f-string:" | ||
| 3209 | + msgid "a *conversion specifier* -- ``!s``, ``!r`` or ``!a``; and/or" | ||
| 3215 | 3210 | msgstr "" | |
| 3216 | 3211 | ||
| 3217 | - msgid "" | ||
| 3218 | - ">>> f'''This is a string\n" | ||
| 3219 | - "... on two lines'''\n" | ||
| 3220 | - "'This is a string\\non two lines'" | ||
| 3212 | + msgid "a *format specifier* prefixed with a colon (``:``)." | ||
| 3221 | 3213 | msgstr "" | |
| 3222 | 3214 | ||
| 3223 | 3215 | msgid "" | |
| 3224 | - "A single opening curly bracket, ``'{'``, marks a *replacement field* that " | ||
| 3225 | - "can contain any Python expression:" | ||
| 3216 | + "See the :ref:`Lexical Analysis section on f-strings <f-strings>` for details " | ||
| 3217 | + "on the syntax of these fields." | ||
| 3226 | 3218 | msgstr "" | |
| 3227 | 3219 | ||
| 3228 | - msgid "" | ||
| 3229 | - ">>> nationality = 'Spanish'\n" | ||
| 3230 | - ">>> f'The {nationality} Inquisition!'\n" | ||
| 3231 | - "'The Spanish Inquisition!'" | ||
| 3220 | + msgid "Debug specifier" | ||
| 3232 | 3221 | msgstr "" | |
| 3233 | 3222 | ||
| 3234 | - msgid "To include a literal ``{`` or ``}``, use a double bracket:" | ||
| 3223 | + msgid "" | ||
| 3224 | + "If a debug specifier -- an equal sign (``=``) -- appears after the " | ||
| 3225 | + "replacement field expression, the resulting f-string will contain the " | ||
| 3226 | + "expression's source, the equal sign, and the value of the expression. This " | ||
| 3227 | + "is often useful for debugging::" | ||
| 3235 | 3228 | msgstr "" | |
| 3236 | 3229 | ||
| 3237 | 3230 | msgid "" | |
| 3238 | - ">>> x = 42\n" | ||
| 3239 | - ">>> f'{{x}} is {x}'\n" | ||
| 3240 | - "'{x} is 42'" | ||
| 3231 | + ">>> number = 14.3\n" | ||
| 3232 | + ">>> f'{number=}'\n" | ||
| 3233 | + "'number=14.3'" | ||
| 3241 | 3234 | msgstr "" | |
| 3242 | 3235 | ||
| 3243 | 3236 | msgid "" | |
| 3244 | - "Functions can also be used, and :ref:`format specifiers <formatstrings>`:" | ||
| 3237 | + "Whitespace before, inside and after the expression, as well as whitespace " | ||
| 3238 | + "after the equal sign, is significant --- it is retained in the result::" | ||
| 3245 | 3239 | msgstr "" | |
| 3246 | 3240 | ||
| 3247 | 3241 | msgid "" | |
| 3248 | - ">>> from math import sqrt\n" | ||
| 3249 | - ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" | ||
| 3250 | - "'√2 ≈ 1.41421'" | ||
| 3242 | + ">>> f'{ number - 4 = }'\n" | ||
| 3243 | + "' number - 4 = 10.3'" | ||
| 3251 | 3244 | msgstr "" | |
| 3252 | 3245 | ||
| 3253 | - msgid "Any non-string expression is converted using :func:`str`, by default:" | ||
| 3246 | + msgid "Conversion specifier" | ||
| 3247 | + msgstr "" | ||
| 3248 | + | ||
| 3249 | + msgid "" | ||
| 3250 | + "By default, the value of a replacement field expression is converted to a " | ||
| 3251 | + "string using :func:`str`::" | ||
| 3254 | 3252 | msgstr "" | |
| 3255 | 3253 | ||
| 3256 | 3254 | msgid "" | |
| 3257 | 3255 | ">>> from fractions import Fraction\n" | |
| 3258 | - ">>> f'{Fraction(1, 3)}'\n" | ||
| 3256 | + ">>> one_third = Fraction(1, 3)\n" | ||
| 3257 | + ">>> f'{one_third}'\n" | ||
| 3259 | 3258 | "'1/3'" | |
| 3260 | 3259 | msgstr "" | |
| 3261 | 3260 | ||
| 3262 | 3261 | msgid "" | |
| 3263 | - "To use an explicit conversion, use the ``!`` (exclamation mark) operator, " | ||
| 3264 | - "followed by any of the valid formats, which are:" | ||
| 3262 | + "When a debug specifier but no format specifier is used, the default " | ||
| 3263 | + "conversion instead uses :func:`repr`::" | ||
| 3265 | 3264 | msgstr "" | |
| 3266 | 3265 | ||
| 3267 | - msgid "Conversion" | ||
| 3266 | + msgid "" | ||
| 3267 | + ">>> f'{one_third = }'\n" | ||
| 3268 | + "'one_third = Fraction(1, 3)'" | ||
| 3268 | 3269 | msgstr "" | |
| 3269 | 3270 | ||
| 3270 | - msgid "``!a``" | ||
| 3271 | - msgstr "``!a``" | ||
| 3272 | - | ||
| 3273 | - msgid ":func:`ascii`" | ||
| 3274 | - msgstr ":func:`ascii`" | ||
| 3275 | - | ||
| 3276 | - msgid "``!r``" | ||
| 3277 | - msgstr "``!r``" | ||
| 3271 | + msgid "" | ||
| 3272 | + "The conversion can be specified explicitly using one of these specifiers:" | ||
| 3273 | + msgstr "" | ||
| 3278 | 3274 | ||
| 3279 | - msgid ":func:`repr`" | ||
| 3280 | - msgstr ":func:`repr`" | ||
| 3275 | + msgid "``!s`` for :func:`str`" | ||
| 3276 | + msgstr "" | ||
| 3281 | 3277 | ||
| 3282 | - msgid "``!s``" | ||
| 3283 | - msgstr "``!s``" | ||
| 3278 | + msgid "``!r`` for :func:`repr`" | ||
| 3279 | + msgstr "" | ||
| 3284 | 3280 | ||
| 3285 | - msgid ":func:`str`" | ||
| 3286 | - msgstr ":func:`str`" | ||
| 3281 | + msgid "``!a`` for :func:`ascii`" | ||
| 3282 | + msgstr "" | ||
| 3287 | 3283 | ||
| 3288 | 3284 | msgid "" | |
| 3289 | - ">>> from fractions import Fraction\n" | ||
| 3290 | - ">>> f'{Fraction(1, 3)!s}'\n" | ||
| 3285 | + ">>> str(one_third)\n" | ||
| 3291 | 3286 | "'1/3'\n" | |
| 3292 | - ">>> f'{Fraction(1, 3)!r}'\n" | ||
| 3287 | + ">>> repr(one_third)\n" | ||
| 3293 | 3288 | "'Fraction(1, 3)'\n" | |
| 3294 | - ">>> question = '¿Dónde está el Presidente?'\n" | ||
| 3295 | - ">>> print(f'{question!a}')\n" | ||
| 3296 | - "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" | ||
| 3289 | + "\n" | ||
| 3290 | + ">>> f'{one_third!s} is {one_third!r}'\n" | ||
| 3291 | + "'1/3 is Fraction(1, 3)'\n" | ||
| 3292 | + "\n" | ||
| 3293 | + ">>> string = \"¡kočka 😸!\"\n" | ||
| 3294 | + ">>> ascii(string)\n" | ||
| 3295 | + "\"'\\\\xa1ko\\\\u010dka \\\\U0001f638!'\"\n" | ||
| 3296 | + "\n" | ||
| 3297 | + ">>> f'{string = !a}'\n" | ||
| 3298 | + "\"string = '\\\\xa1ko\\\\u010dka \\\\U0001f638!'\"" | ||
| 3299 | + msgstr "" | ||
| 3300 | + | ||
| 3301 | + msgid "Format specifier" | ||
| 3297 | 3302 | msgstr "" | |
| 3298 | 3303 | ||
| 3299 | 3304 | msgid "" | |
| 3300 | - "While debugging it may be helpful to see both the expression and its value, " | ||
| 3301 | - "by using the equals sign (``=``) after the expression. This preserves spaces " | ||
| 3302 | - "within the brackets, and can be used with a converter. By default, the " | ||
| 3303 | - "debugging operator uses the :func:`repr` (``!r``) conversion. For example:" | ||
| 3305 | + "After the expression has been evaluated, and possibly converted using an " | ||
| 3306 | + "explicit conversion specifier, it is formatted using the :func:`format` " | ||
| 3307 | + "function. If the replacement field includes a *format specifier* introduced " | ||
| 3308 | + "by a colon (``:``), the specifier is passed to :func:`!format` as the second " | ||
| 3309 | + "argument. The result of :func:`!format` is then used as the final value for " | ||
| 3310 | + "the replacement field. For example::" | ||
| 3304 | 3311 | msgstr "" | |
| 3305 | 3312 | ||
| 3306 | 3313 | msgid "" | |
| 3307 | 3314 | ">>> from fractions import Fraction\n" | |
| 3308 | - ">>> calculation = Fraction(1, 3)\n" | ||
| 3309 | - ">>> f'{calculation=}'\n" | ||
| 3310 | - "'calculation=Fraction(1, 3)'\n" | ||
| 3311 | - ">>> f'{calculation = }'\n" | ||
| 3312 | - "'calculation = Fraction(1, 3)'\n" | ||
| 3313 | - ">>> f'{calculation = !s}'\n" | ||
| 3314 | - "'calculation = 1/3'" | ||
| 3315 | + ">>> one_third = Fraction(1, 3)\n" | ||
| 3316 | + ">>> f'{one_third:.6f}'\n" | ||
| 3317 | + "'0.333333'\n" | ||
| 3318 | + ">>> f'{one_third:_^+10}'\n" | ||
| 3319 | + "'___+1/3___'\n" | ||
| 3320 | + ">>> >>> f'{one_third!r:_^20}'\n" | ||
| 3321 | + "'___Fraction(1, 3)___'\n" | ||
| 3322 | + ">>> f'{one_third = :~>10}~'\n" | ||
| 3323 | + "'one_third = ~~~~~~~1/3~'" | ||
| 3324 | + msgstr "" | ||
| 3325 | + | ||
| 3326 | + msgid "Template String Literals (t-strings)" | ||
| 3315 | 3327 | msgstr "" | |
| 3316 | 3328 | ||
| 3317 | 3329 | msgid "" | |
| 3318 | - "Once the output has been evaluated, it can be formatted using a :ref:`format " | ||
| 3319 | - "specifier <formatstrings>` following a colon (``':'``). After the expression " | ||
| 3320 | - "has been evaluated, and possibly converted to a string, the :meth:`!" | ||
| 3321 | - "__format__` method of the result is called with the format specifier, or the " | ||
| 3322 | - "empty string if no format specifier is given. The formatted result is then " | ||
| 3323 | - "used as the final value for the replacement field. For example:" | ||
| 3330 | + "An :dfn:`t-string` (formally a :dfn:`template string literal`) is a string " | ||
| 3331 | + "literal that is prefixed with ``t`` or ``T``." | ||
| 3324 | 3332 | msgstr "" | |
| 3325 | 3333 | ||
| 3326 | 3334 | msgid "" | |
| 3327 | - ">>> from fractions import Fraction\n" | ||
| 3328 | - ">>> f'{Fraction(1, 7):.6f}'\n" | ||
| 3329 | - "'0.142857'\n" | ||
| 3330 | - ">>> f'{Fraction(1, 7):_^+10}'\n" | ||
| 3331 | - "'___+1/7___'" | ||
| 3335 | + "These strings follow the same syntax and evaluation rules as :ref:`formatted " | ||
| 3336 | + "string literals <stdtypes-fstrings>`, with for the following differences:" | ||
| 3337 | + msgstr "" | ||
| 3338 | + | ||
| 3339 | + msgid "" | ||
| 3340 | + "Rather than evaluating to a ``str`` object, template string literals " | ||
| 3341 | + "evaluate to a :class:`string.templatelib.Template` object." | ||
| 3342 | + msgstr "" | ||
| 3343 | + | ||
| 3344 | + msgid "" | ||
| 3345 | + "The :func:`format` protocol is not used. Instead, the format specifier and " | ||
| 3346 | + "conversions (if any) are passed to a new :class:`~string.templatelib." | ||
| 3347 | + "Interpolation` object that is created for each evaluated expression. It is " | ||
| 3348 | + "up to code that processes the resulting :class:`~string.templatelib." | ||
| 3349 | + "Template` object to decide how to handle format specifiers and conversions." | ||
| 3350 | + msgstr "" | ||
| 3351 | + | ||
| 3352 | + msgid "" | ||
| 3353 | + "Format specifiers containing nested replacement fields are evaluated " | ||
| 3354 | + "eagerly, prior to being passed to the :class:`~string.templatelib." | ||
| 3355 | + "Interpolation` object. For instance, an interpolation of the form ``{amount:." | ||
| 3356 | + "{precision}f}`` will evaluate the inner expression ``{precision}`` to " | ||
| 3357 | + "determine the value of the ``format_spec`` attribute. If ``precision`` were " | ||
| 3358 | + "to be ``2``, the resulting format specifier would be ``'.2f'``." | ||
| 3359 | + msgstr "" | ||
| 3360 | + | ||
| 3361 | + msgid "" | ||
| 3362 | + "When the equals sign ``'='`` is provided in an interpolation expression, the " | ||
| 3363 | + "text of the expression is appended to the literal string that precedes the " | ||
| 3364 | + "relevant interpolation. This includes the equals sign and any surrounding " | ||
| 3365 | + "whitespace. The :class:`!Interpolation` instance for the expression will be " | ||
| 3366 | + "created as normal, except that :attr:`~string.templatelib.Interpolation." | ||
| 3367 | + "conversion` will be set to '``r``' (:func:`repr`) by default. If an explicit " | ||
| 3368 | + "conversion or format specifier are provided, this will override the default " | ||
| 3369 | + "behaviour." | ||
| 3332 | 3370 | msgstr "" | |
| 3333 | 3371 | ||
| 3334 | 3372 | msgid "``printf``-style String Formatting" | |
@@ -3468,6 +3506,9 @@ msgstr "" | |||
| 3468 | 3506 | msgid "The conversion types are:" | |
| 3469 | 3507 | msgstr "" | |
| 3470 | 3508 | ||
| 3509 | + msgid "Conversion" | ||
| 3510 | + msgstr "" | ||
| 3511 | + | ||
| 3471 | 3512 | msgid "``'d'``" | |
| 3472 | 3513 | msgstr "``'d'``" | |
| 3473 | 3514 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments