-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path3.10.po
More file actions
3119 lines (2569 loc) · 104 KB
/
3.10.po
File metadata and controls
3119 lines (2569 loc) · 104 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2026, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Rafael Fontenelle <[email protected]>, 2025
# python-doc bot, 2025
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.12\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-04-11 16:04+0000\n"
"PO-Revision-Date: 2025-07-18 19:59+0000\n"
"Last-Translator: python-doc bot, 2025\n"
"Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pl\n"
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && "
"(n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && "
"n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
msgid "What's New In Python 3.10"
msgstr "Co nowego w Pythonie 3.10"
msgid "Editor"
msgstr "redakcja"
msgid "Pablo Galindo Salgado"
msgstr "Pablo Galindo Salgado"
msgid ""
"This article explains the new features in Python 3.10, compared to 3.9. "
"Python 3.10 was released on October 4, 2021. For full details, see the :ref:"
"`changelog <changelog>`."
msgstr ""
"W tym artykule wyjaśniono nowe funkcje w Pythonie 3.10 w porównaniu z wersją "
"3.9. Python 3.10 został wydany 4 października 2021 r. Aby uzyskać "
"szczegółowe informacje, zobacz :ref:`changelog <changelog>`."
msgid "Summary -- Release highlights"
msgstr "Podsumowanie – najważniejsze nowości"
msgid "New syntax features:"
msgstr "Nowe cechy składni:"
msgid ":pep:`634`, Structural Pattern Matching: Specification"
msgstr ":pep:`634`, Structural Pattern Matching: Specyfikacja"
msgid ":pep:`635`, Structural Pattern Matching: Motivation and Rationale"
msgstr ":pep:`635`, Structural Pattern Matching: Motywacja i uzasadnienie"
msgid ":pep:`636`, Structural Pattern Matching: Tutorial"
msgstr ":pep:`636`, Structural Pattern Matching: Tutorial"
msgid ""
":issue:`12782`, Parenthesized context managers are now officially allowed."
msgstr ""
":issue:`12782`, Context managery otoczone nawiasami są teraz oficjalnie "
"wspierane."
msgid "New features in the standard library:"
msgstr "Nowe funkcjonalności w bibliotece standardowej:"
msgid ":pep:`618`, Add Optional Length-Checking To zip."
msgstr ":pep:`618`, Dodane opcjonalne sprawdzenie długości do zip."
msgid "Interpreter improvements:"
msgstr "Udoskonalenia interpretera:"
msgid ":pep:`626`, Precise line numbers for debugging and other tools."
msgstr ":pep:`626`, Dokładne numery linii dla debuggowania i innych narzędzi."
msgid "New typing features:"
msgstr "Nowe cechy typowania:"
msgid ":pep:`604`, Allow writing union types as X | Y"
msgstr ":pep:`604`, Zezwolone pisanie sumy typów jako X | Y"
msgid ":pep:`612`, Parameter Specification Variables"
msgstr ":pep:`612`, Zmienne specyfikacji parametrów"
msgid ":pep:`613`, Explicit Type Aliases"
msgstr ":pep:`613`, Explicit Type Aliases"
msgid ":pep:`647`, User-Defined Type Guards"
msgstr ""
msgid "Important deprecations, removals or restrictions:"
msgstr "Ważne dezaprobaty, usunięcia lub ograniczenia:"
msgid ":pep:`644`, Require OpenSSL 1.1.1 or newer"
msgstr ":pep:`644`, Wymagane OpenSSL 1.1.1 lub nowsze"
msgid ":pep:`632`, Deprecate distutils module."
msgstr ":pep:`632`, Zdezaprobowany moduł distutils."
msgid ""
":pep:`623`, Deprecate and prepare for the removal of the wstr member in "
"PyUnicodeObject."
msgstr ""
":pep:`623`, Zdezaprobowanie i przygotowanie do usunięcia elementu wstr w "
"PyUnicodeObject."
msgid ":pep:`624`, Remove Py_UNICODE encoder APIs"
msgstr ":pep:`624`, Usunięte API encodera Py_UNICODE"
msgid ":pep:`597`, Add optional EncodingWarning"
msgstr ":pep:`597`, Dodany opcjonalny EncodingWarning"
msgid "New Features"
msgstr "Nowe funkcjonalności"
msgid "Parenthesized context managers"
msgstr "Context managery w nawiasach"
msgid ""
"Using enclosing parentheses for continuation across multiple lines in "
"context managers is now supported. This allows formatting a long collection "
"of context managers in multiple lines in a similar way as it was previously "
"possible with import statements. For instance, all these examples are now "
"valid:"
msgstr ""
"Użycie zewnętrzych nawiasów dla kontynuacji w wielu liniach w context "
"managerach jest teraz wspierane. Pozwala to formatować długą kolekcję "
"context managerów w wielu liniach w podobny sposób, jak można to robić z "
"instrukcjami import. Na przykład wszystkie te przykłady są teraz poprawne:"
msgid ""
"with (CtxManager() as example):\n"
" ...\n"
"\n"
"with (\n"
" CtxManager1(),\n"
" CtxManager2()\n"
"):\n"
" ...\n"
"\n"
"with (CtxManager1() as example,\n"
" CtxManager2()):\n"
" ...\n"
"\n"
"with (CtxManager1(),\n"
" CtxManager2() as example):\n"
" ...\n"
"\n"
"with (\n"
" CtxManager1() as example1,\n"
" CtxManager2() as example2\n"
"):\n"
" ..."
msgstr ""
msgid ""
"it is also possible to use a trailing comma at the end of the enclosed group:"
msgstr "Można też użyć przecinka na końcu grupy otoczonej nawiasami:"
msgid ""
"with (\n"
" CtxManager1() as example1,\n"
" CtxManager2() as example2,\n"
" CtxManager3() as example3,\n"
"):\n"
" ..."
msgstr ""
msgid ""
"This new syntax uses the non LL(1) capacities of the new parser. Check :pep:"
"`617` for more details."
msgstr ""
"Ta nowa składnia używa zdolności nie-LL(1) nowego parsera. Więcej szczegółów "
"znajdziesz w :pep:`617`."
msgid ""
"(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou in :"
"issue:`12782` and :issue:`40334`.)"
msgstr ""
"(Napisane przez Guido van Rossuma, Pablo Galinda i Lysandrosa Nikolaou w :"
"issue:`12782` i :issue:`40334`.)"
msgid "Better error messages"
msgstr "Lepsze komunikaty błędów"
msgid "SyntaxErrors"
msgstr "SyntaxErrors"
msgid ""
"When parsing code that contains unclosed parentheses or brackets the "
"interpreter now includes the location of the unclosed bracket of parentheses "
"instead of displaying *SyntaxError: unexpected EOF while parsing* or "
"pointing to some incorrect location. For instance, consider the following "
"code (notice the unclosed '{'):"
msgstr ""
"Podczas analizowania kodu, który zawiera niezamknięte nawiasy lub nawiasy, "
"interpreter uwzględnia teraz lokalizację niezamkniętych nawiasów, zamiast "
"wyświetlać *SyntaxError: nieoczekiwany EOF podczas analizowania* lub "
"wskazywać nieprawidłową lokalizację. Rozważmy na przykład następujący kod "
"(zwróć uwagę na niezamknięte '{'):"
msgid ""
"expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,\n"
" 38: 4, 39: 4, 45: 5, 46: 5, 47: 5, 48: 5, 49: 5, 54: 6,\n"
"some_other_code = foo()"
msgstr ""
msgid ""
"Previous versions of the interpreter reported confusing places as the "
"location of the syntax error:"
msgstr ""
"Poprzednie wersje interpretera podawały mylące miejsca jako lokalizację "
"błędu składniowego:"
msgid ""
"File \"example.py\", line 3\n"
" some_other_code = foo()\n"
" ^\n"
"SyntaxError: invalid syntax"
msgstr ""
msgid "but in Python 3.10 a more informative error is emitted:"
msgstr "ale w Pythonie 3.10 emitowany jest bardziej informacyjny błąd:"
msgid ""
"File \"example.py\", line 1\n"
" expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,\n"
" ^\n"
"SyntaxError: '{' was never closed"
msgstr ""
msgid ""
"In a similar way, errors involving unclosed string literals (single and "
"triple quoted) now point to the start of the string instead of reporting EOF/"
"EOL."
msgstr ""
"W podobny sposób błędy związane z niezamkniętymi literałami łańcuchowymi "
"(pojedyncze i potrójne cudzysłowy) wskazują teraz początek łańcucha zamiast "
"raportowania EOF/EOL."
msgid ""
"These improvements are inspired by previous work in the PyPy interpreter."
msgstr ""
"Te ulepszenia są inspirowane wcześniejszymi pracami nad interpreterem PyPy."
msgid ""
"(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya in :"
"issue:`40176`.)"
msgstr ""
msgid ""
":exc:`SyntaxError` exceptions raised by the interpreter will now highlight "
"the full error range of the expression that constitutes the syntax error "
"itself, instead of just where the problem is detected. In this way, instead "
"of displaying (before Python 3.10):"
msgstr ""
msgid ""
">>> foo(x, z for z in range(10), t, w)\n"
" File \"<stdin>\", line 1\n"
" foo(x, z for z in range(10), t, w)\n"
" ^\n"
"SyntaxError: Generator expression must be parenthesized"
msgstr ""
msgid "now Python 3.10 will display the exception as:"
msgstr "teraz Python 3.10 wyświetli wyjątek jako:"
msgid ""
">>> foo(x, z for z in range(10), t, w)\n"
" File \"<stdin>\", line 1\n"
" foo(x, z for z in range(10), t, w)\n"
" ^^^^^^^^^^^^^^^^^^^^\n"
"SyntaxError: Generator expression must be parenthesized"
msgstr ""
msgid "This improvement was contributed by Pablo Galindo in :issue:`43914`."
msgstr "Do poprawy tej przyczynił się Pablo Galindo w :issue:`43914`"
msgid ""
"A considerable amount of new specialized messages for :exc:`SyntaxError` "
"exceptions have been incorporated. Some of the most notable ones are as "
"follows:"
msgstr ""
msgid "Missing ``:`` before blocks:"
msgstr "Brakuje ``:`` przed blokami:"
msgid ""
">>> if rocket.position > event_horizon\n"
" File \"<stdin>\", line 1\n"
" if rocket.position > event_horizon\n"
" ^\n"
"SyntaxError: expected ':'"
msgstr ""
msgid "(Contributed by Pablo Galindo in :issue:`42997`.)"
msgstr "(Autor: Pablo Galindo w :issue:`42997`.)"
msgid "Unparenthesised tuples in comprehensions targets:"
msgstr ""
msgid ""
">>> {x,y for x,y in zip('abcd', '1234')}\n"
" File \"<stdin>\", line 1\n"
" {x,y for x,y in zip('abcd', '1234')}\n"
" ^\n"
"SyntaxError: did you forget parentheses around the comprehension target?"
msgstr ""
msgid "(Contributed by Pablo Galindo in :issue:`43017`.)"
msgstr "(Autor: Pablo Galindo w :issue:`43017`.)"
msgid "Missing commas in collection literals and between expressions:"
msgstr "Brakujące przecinki w literałach kolekcji i między wyrażeniami:"
msgid ""
">>> items = {\n"
"... x: 1,\n"
"... y: 2\n"
"... z: 3,\n"
" File \"<stdin>\", line 3\n"
" y: 2\n"
" ^\n"
"SyntaxError: invalid syntax. Perhaps you forgot a comma?"
msgstr ""
msgid "(Contributed by Pablo Galindo in :issue:`43822`.)"
msgstr ""
msgid "Multiple Exception types without parentheses:"
msgstr ""
msgid ""
">>> try:\n"
"... build_dyson_sphere()\n"
"... except NotEnoughScienceError, NotEnoughResourcesError:\n"
" File \"<stdin>\", line 3\n"
" except NotEnoughScienceError, NotEnoughResourcesError:\n"
" ^\n"
"SyntaxError: multiple exception types must be parenthesized"
msgstr ""
msgid "(Contributed by Pablo Galindo in :issue:`43149`.)"
msgstr ""
msgid "Missing ``:`` and values in dictionary literals:"
msgstr ""
msgid ""
">>> values = {\n"
"... x: 1,\n"
"... y: 2,\n"
"... z:\n"
"... }\n"
" File \"<stdin>\", line 4\n"
" z:\n"
" ^\n"
"SyntaxError: expression expected after dictionary key and ':'\n"
"\n"
">>> values = {x:1, y:2, z w:3}\n"
" File \"<stdin>\", line 1\n"
" values = {x:1, y:2, z w:3}\n"
" ^\n"
"SyntaxError: ':' expected after dictionary key"
msgstr ""
msgid "(Contributed by Pablo Galindo in :issue:`43823`.)"
msgstr ""
msgid "``try`` blocks without ``except`` or ``finally`` blocks:"
msgstr ""
msgid ""
">>> try:\n"
"... x = 2\n"
"... something = 3\n"
" File \"<stdin>\", line 3\n"
" something = 3\n"
" ^^^^^^^^^\n"
"SyntaxError: expected 'except' or 'finally' block"
msgstr ""
msgid "(Contributed by Pablo Galindo in :issue:`44305`.)"
msgstr ""
msgid "Usage of ``=`` instead of ``==`` in comparisons:"
msgstr ""
msgid ""
">>> if rocket.position = event_horizon:\n"
" File \"<stdin>\", line 1\n"
" if rocket.position = event_horizon:\n"
" ^\n"
"SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead "
"of '='?"
msgstr ""
msgid "(Contributed by Pablo Galindo in :issue:`43797`.)"
msgstr ""
msgid "Usage of ``*`` in f-strings:"
msgstr ""
msgid ""
">>> f\"Black holes {*all_black_holes} and revelations\"\n"
" File \"<stdin>\", line 1\n"
" (*all_black_holes)\n"
" ^\n"
"SyntaxError: f-string: cannot use starred expression here"
msgstr ""
msgid "(Contributed by Pablo Galindo in :issue:`41064`.)"
msgstr ""
msgid "IndentationErrors"
msgstr ""
msgid ""
"Many :exc:`IndentationError` exceptions now have more context regarding what "
"kind of block was expecting an indentation, including the location of the "
"statement:"
msgstr ""
msgid ""
">>> def foo():\n"
"... if lel:\n"
"... x = 2\n"
" File \"<stdin>\", line 3\n"
" x = 2\n"
" ^\n"
"IndentationError: expected an indented block after 'if' statement in line 2"
msgstr ""
msgid "AttributeErrors"
msgstr ""
msgid ""
"When printing :exc:`AttributeError`, :c:func:`!PyErr_Display` will offer "
"suggestions of similar attribute names in the object that the exception was "
"raised from:"
msgstr ""
msgid ""
">>> collections.namedtoplo\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 1, in <module>\n"
"AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you "
"mean: namedtuple?"
msgstr ""
msgid "(Contributed by Pablo Galindo in :issue:`38530`.)"
msgstr ""
msgid ""
"Notice this won't work if :c:func:`!PyErr_Display` is not called to display "
"the error which can happen if some other custom error display function is "
"used. This is a common scenario in some REPLs like IPython."
msgstr ""
msgid "NameErrors"
msgstr ""
msgid ""
"When printing :exc:`NameError` raised by the interpreter, :c:func:`!"
"PyErr_Display` will offer suggestions of similar variable names in the "
"function that the exception was raised from:"
msgstr ""
msgid ""
">>> schwarzschild_black_hole = None\n"
">>> schwarschild_black_hole\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 1, in <module>\n"
"NameError: name 'schwarschild_black_hole' is not defined. Did you mean: "
"schwarzschild_black_hole?"
msgstr ""
msgid ""
"Notice this won't work if :c:func:`!PyErr_Display` is not called to display "
"the error, which can happen if some other custom error display function is "
"used. This is a common scenario in some REPLs like IPython."
msgstr ""
msgid "PEP 626: Precise line numbers for debugging and other tools"
msgstr "PEP 626: Precyzyjne numerowanie linii do debugowania i innych narzędzi"
msgid ""
"PEP 626 brings more precise and reliable line numbers for debugging, "
"profiling and coverage tools. Tracing events, with the correct line number, "
"are generated for all lines of code executed and only for lines of code that "
"are executed."
msgstr ""
"PEP 626 zapewnia bardziej precyzyjne i niezawodne numerowanie linii dla "
"narzędzi do debugowania, profilowania i pokrycia. Zdarzenia śledzenia z "
"poprawnym numerem wiersza są generowane dla wszystkich wykonanych wierszy "
"kodu i tylko dla wykonanych wierszy kodu."
msgid ""
"The :attr:`~frame.f_lineno` attribute of frame objects will always contain "
"the expected line number."
msgstr ""
msgid ""
"The :attr:`~codeobject.co_lnotab` attribute of :ref:`code objects <code-"
"objects>` is deprecated and will be removed in 3.12. Code that needs to "
"convert from offset to line number should use the new :meth:`~codeobject."
"co_lines` method instead."
msgstr ""
msgid "PEP 634: Structural Pattern Matching"
msgstr ""
msgid ""
"Structural pattern matching has been added in the form of a *match "
"statement* and *case statements* of patterns with associated actions. "
"Patterns consist of sequences, mappings, primitive data types as well as "
"class instances. Pattern matching enables programs to extract information "
"from complex data types, branch on the structure of data, and apply specific "
"actions based on different forms of data."
msgstr ""
msgid "Syntax and operations"
msgstr "Składnia i operacje"
msgid "The generic syntax of pattern matching is::"
msgstr "Ogólna składnia dopasowywania wzorców jest następująca::"
msgid ""
"match subject:\n"
" case <pattern_1>:\n"
" <action_1>\n"
" case <pattern_2>:\n"
" <action_2>\n"
" case <pattern_3>:\n"
" <action_3>\n"
" case _:\n"
" <action_wildcard>"
msgstr ""
msgid ""
"A match statement takes an expression and compares its value to successive "
"patterns given as one or more case blocks. Specifically, pattern matching "
"operates by:"
msgstr ""
"Instrukcja dopasowania przyjmuje wyrażenie i porównuje jego wartość z "
"kolejnymi wzorcami podanymi jako jeden lub więcej bloków przypadków. W "
"szczególności dopasowanie wzorców działa poprzez:"
msgid "using data with type and shape (the ``subject``)"
msgstr ""
msgid "evaluating the ``subject`` in the ``match`` statement"
msgstr ""
msgid ""
"comparing the subject with each pattern in a ``case`` statement from top to "
"bottom until a match is confirmed."
msgstr ""
msgid "executing the action associated with the pattern of the confirmed match"
msgstr ""
msgid ""
"If an exact match is not confirmed, the last case, a wildcard ``_``, if "
"provided, will be used as the matching case. If an exact match is not "
"confirmed and a wildcard case does not exist, the entire match block is a no-"
"op."
msgstr ""
msgid "Declarative approach"
msgstr ""
msgid ""
"Readers may be aware of pattern matching through the simple example of "
"matching a subject (data object) to a literal (pattern) with the switch "
"statement found in C, Java or JavaScript (and many other languages). Often "
"the switch statement is used for comparison of an object/expression with "
"case statements containing literals."
msgstr ""
msgid ""
"More powerful examples of pattern matching can be found in languages such as "
"Scala and Elixir. With structural pattern matching, the approach is "
"\"declarative\" and explicitly states the conditions (the patterns) for data "
"to match."
msgstr ""
msgid ""
"While an \"imperative\" series of instructions using nested \"if\" "
"statements could be used to accomplish something similar to structural "
"pattern matching, it is less clear than the \"declarative\" approach. "
"Instead the \"declarative\" approach states the conditions to meet for a "
"match and is more readable through its explicit patterns. While structural "
"pattern matching can be used in its simplest form comparing a variable to a "
"literal in a case statement, its true value for Python lies in its handling "
"of the subject's type and shape."
msgstr ""
msgid "Simple pattern: match to a literal"
msgstr "Prosty wzór: dopasowanie do literału"
msgid ""
"Let's look at this example as pattern matching in its simplest form: a "
"value, the subject, being matched to several literals, the patterns. In the "
"example below, ``status`` is the subject of the match statement. The "
"patterns are each of the case statements, where literals represent request "
"status codes. The associated action to the case is executed after a match::"
msgstr ""
msgid ""
"def http_error(status):\n"
" match status:\n"
" case 400:\n"
" return \"Bad request\"\n"
" case 404:\n"
" return \"Not found\"\n"
" case 418:\n"
" return \"I'm a teapot\"\n"
" case _:\n"
" return \"Something's wrong with the internet\""
msgstr ""
"def http_error(status):\n"
" match status:\n"
" case 400:\n"
" return \"Niewłaściwe żądanie\"\n"
" case 404:\n"
" return \"Nie znaleziono\"\n"
" case 418:\n"
" return \"Jestem czajniczkiem\"\n"
" case _:\n"
" return \"Coś jest nie tak z internetem\""
msgid ""
"If the above function is passed a ``status`` of 418, \"I'm a teapot\" is "
"returned. If the above function is passed a ``status`` of 500, the case "
"statement with ``_`` will match as a wildcard, and \"Something's wrong with "
"the internet\" is returned. Note the last block: the variable name, ``_``, "
"acts as a *wildcard* and insures the subject will always match. The use of "
"``_`` is optional."
msgstr ""
msgid ""
"You can combine several literals in a single pattern using ``|`` (\"or\")::"
msgstr "Możesz łączyć kilka literałów w jeden wzorzec używając ``|`` („or”)::"
msgid ""
"case 401 | 403 | 404:\n"
" return \"Not allowed\""
msgstr ""
"case 401 | 403 | 404:\n"
" return \"Niedozwolone\""
msgid "Behavior without the wildcard"
msgstr ""
msgid ""
"If we modify the above example by removing the last case block, the example "
"becomes::"
msgstr ""
msgid ""
"def http_error(status):\n"
" match status:\n"
" case 400:\n"
" return \"Bad request\"\n"
" case 404:\n"
" return \"Not found\"\n"
" case 418:\n"
" return \"I'm a teapot\""
msgstr ""
msgid ""
"Without the use of ``_`` in a case statement, a match may not exist. If no "
"match exists, the behavior is a no-op. For example, if ``status`` of 500 is "
"passed, a no-op occurs."
msgstr ""
msgid "Patterns with a literal and variable"
msgstr ""
msgid ""
"Patterns can look like unpacking assignments, and a pattern may be used to "
"bind variables. In this example, a data point can be unpacked to its x-"
"coordinate and y-coordinate::"
msgstr ""
msgid ""
"# point is an (x, y) tuple\n"
"match point:\n"
" case (0, 0):\n"
" print(\"Origin\")\n"
" case (0, y):\n"
" print(f\"Y={y}\")\n"
" case (x, 0):\n"
" print(f\"X={x}\")\n"
" case (x, y):\n"
" print(f\"X={x}, Y={y}\")\n"
" case _:\n"
" raise ValueError(\"Not a point\")"
msgstr ""
"# punkt to dwukrotka (x, y)\n"
"match point:\n"
" case (0, 0):\n"
" print(\"Początek\")\n"
" case (0, y):\n"
" print(f\"Y={y}\")\n"
" case (x, 0):\n"
" print(f\"X={x}\")\n"
" case (x, y):\n"
" print(f\"X={x}, Y={y}\")\n"
" case _:\n"
" raise ValueError(\"Nie punkt\")"
msgid ""
"The first pattern has two literals, ``(0, 0)``, and may be thought of as an "
"extension of the literal pattern shown above. The next two patterns combine "
"a literal and a variable, and the variable *binds* a value from the subject "
"(``point``). The fourth pattern captures two values, which makes it "
"conceptually similar to the unpacking assignment ``(x, y) = point``."
msgstr ""
msgid "Patterns and classes"
msgstr ""
msgid ""
"If you are using classes to structure your data, you can use as a pattern "
"the class name followed by an argument list resembling a constructor. This "
"pattern has the ability to capture class attributes into variables::"
msgstr ""
msgid ""
"class Point:\n"
" x: int\n"
" y: int\n"
"\n"
"def location(point):\n"
" match point:\n"
" case Point(x=0, y=0):\n"
" print(\"Origin is the point's location.\")\n"
" case Point(x=0, y=y):\n"
" print(f\"Y={y} and the point is on the y-axis.\")\n"
" case Point(x=x, y=0):\n"
" print(f\"X={x} and the point is on the x-axis.\")\n"
" case Point():\n"
" print(\"The point is located somewhere else on the plane.\")\n"
" case _:\n"
" print(\"Not a point\")"
msgstr ""
msgid "Patterns with positional parameters"
msgstr ""
msgid ""
"You can use positional parameters with some builtin classes that provide an "
"ordering for their attributes (e.g. dataclasses). You can also define a "
"specific position for attributes in patterns by setting the "
"``__match_args__`` special attribute in your classes. If it's set to (\"x\", "
"\"y\"), the following patterns are all equivalent (and all bind the ``y`` "
"attribute to the ``var`` variable)::"
msgstr ""
"Możesz użyć parametrów pozycyjnych z jakimiś wbudowanymi klasami, które "
"posiadają kolejność dla atrybutów (na przykład dataclasses). Możesz też "
"określić wybrane pozycje dla atrybutów we wzorcach ustawiając specjalny "
"atrybut ``__match_args__`` w twoich klasach. Jeśli jest on ustawiony na "
"(„x”, „y”), wszystkie następujące wzorce są równoważne (i wszystkie "
"powiązują atrybut ``y`` ze zmienną ``var``)::"
msgid ""
"Point(1, var)\n"
"Point(1, y=var)\n"
"Point(x=1, y=var)\n"
"Point(y=var, x=1)"
msgstr ""
"Point(1, var)\n"
"Point(1, y=var)\n"
"Point(x=1, y=var)\n"
"Point(y=var, x=1)"
msgid "Nested patterns"
msgstr ""
msgid ""
"Patterns can be arbitrarily nested. For example, if our data is a short "
"list of points, it could be matched like this::"
msgstr ""
msgid ""
"match points:\n"
" case []:\n"
" print(\"No points in the list.\")\n"
" case [Point(0, 0)]:\n"
" print(\"The origin is the only point in the list.\")\n"
" case [Point(x, y)]:\n"
" print(f\"A single point {x}, {y} is in the list.\")\n"
" case [Point(0, y1), Point(0, y2)]:\n"
" print(f\"Two points on the Y axis at {y1}, {y2} are in the list.\")\n"
" case _:\n"
" print(\"Something else is found in the list.\")"
msgstr ""
msgid "Complex patterns and the wildcard"
msgstr ""
msgid ""
"To this point, the examples have used ``_`` alone in the last case "
"statement. A wildcard can be used in more complex patterns, such as "
"``('error', code, _)``. For example::"
msgstr ""
msgid ""
"match test_variable:\n"
" case ('warning', code, 40):\n"
" print(\"A warning has been received.\")\n"
" case ('error', code, _):\n"
" print(f\"An error {code} occurred.\")"
msgstr ""
msgid ""
"In the above case, ``test_variable`` will match for ('error', code, 100) and "
"('error', code, 800)."
msgstr ""
msgid "Guard"
msgstr ""
msgid ""
"We can add an ``if`` clause to a pattern, known as a \"guard\". If the "
"guard is false, ``match`` goes on to try the next case block. Note that "
"value capture happens before the guard is evaluated::"
msgstr ""
"Możemy dodać klauzulę ``if`` do wzorca, nazywaną „guardem”. Jeśli guard jest "
"fałszywy, ``match`` próbuje dopasować następny blok case. Zwróć uwagę, że "
"przechwycenie wartości dzieje się zanim wyliczona jest wartość guarda::"
msgid ""
"match point:\n"
" case Point(x, y) if x == y:\n"
" print(f\"The point is located on the diagonal Y=X at {x}.\")\n"
" case Point(x, y):\n"
" print(f\"Point is not on the diagonal.\")"
msgstr ""
msgid "Other Key Features"
msgstr ""
msgid "Several other key features:"
msgstr "Kilka innych kluczowych cech:"
msgid ""
"Like unpacking assignments, tuple and list patterns have exactly the same "
"meaning and actually match arbitrary sequences. Technically, the subject "
"must be a sequence. Therefore, an important exception is that patterns don't "
"match iterators. Also, to prevent a common mistake, sequence patterns don't "
"match strings."
msgstr ""
msgid ""
"Sequence patterns support wildcards: ``[x, y, *rest]`` and ``(x, y, *rest)`` "
"work similar to wildcards in unpacking assignments. The name after ``*`` "
"may also be ``_``, so ``(x, y, *_)`` matches a sequence of at least two "
"items without binding the remaining items."
msgstr ""
msgid ""
"Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the "
"``\"bandwidth\"`` and ``\"latency\"`` values from a dict. Unlike sequence "
"patterns, extra keys are ignored. A wildcard ``**rest`` is also supported. "
"(But ``**_`` would be redundant, so is not allowed.)"
msgstr ""
msgid "Subpatterns may be captured using the ``as`` keyword::"
msgstr "Można przechwytywać podwzorce używając słowa kluczowego ``as``::"
msgid "case (Point(x1, y1), Point(x2, y2) as p2): ..."
msgstr "case (Point(x1, y1), Point(x2, y2) as p2): ..."
msgid ""
"This binds x1, y1, x2, y2 like you would expect without the ``as`` clause, "
"and p2 to the entire second item of the subject."
msgstr ""
msgid ""
"Most literals are compared by equality. However, the singletons ``True``, "
"``False`` and ``None`` are compared by identity."
msgstr ""
msgid ""
"Named constants may be used in patterns. These named constants must be "
"dotted names to prevent the constant from being interpreted as a capture "
"variable::"
msgstr ""
msgid ""
"from enum import Enum\n"
"class Color(Enum):\n"
" RED = 0\n"
" GREEN = 1\n"
" BLUE = 2\n"
"\n"
"color = Color.GREEN\n"
"match color:\n"
" case Color.RED:\n"
" print(\"I see red!\")\n"
" case Color.GREEN:\n"
" print(\"Grass is green\")\n"
" case Color.BLUE:\n"
" print(\"I'm feeling the blues :(\")"
msgstr ""
msgid ""
"For the full specification see :pep:`634`. Motivation and rationale are in :"
"pep:`635`, and a longer tutorial is in :pep:`636`."
msgstr ""
msgid "Optional ``EncodingWarning`` and ``encoding=\"locale\"`` option"
msgstr ""
msgid ""
"The default encoding of :class:`~io.TextIOWrapper` and :func:`open` is "
"platform and locale dependent. Since UTF-8 is used on most Unix platforms, "
"omitting ``encoding`` option when opening UTF-8 files (e.g. JSON, YAML, "
"TOML, Markdown) is a very common bug. For example::"
msgstr ""
msgid ""
"# BUG: \"rb\" mode or encoding=\"utf-8\" should be used.\n"
"with open(\"data.json\") as f:\n"
" data = json.load(f)"
msgstr ""
msgid ""
"To find this type of bug, an optional ``EncodingWarning`` is added. It is "
"emitted when :data:`sys.flags.warn_default_encoding <sys.flags>` is true and "
"locale-specific default encoding is used."
msgstr ""
msgid ""
"``-X warn_default_encoding`` option and :envvar:`PYTHONWARNDEFAULTENCODING` "
"are added to enable the warning."
msgstr ""
msgid "See :ref:`io-text-encoding` for more information."
msgstr ""
msgid "New Features Related to Type Hints"
msgstr ""
msgid ""
"This section covers major changes affecting :pep:`484` type hints and the :"
"mod:`typing` module."
msgstr ""
msgid "PEP 604: New Type Union Operator"
msgstr ""
msgid ""
"A new type union operator was introduced which enables the syntax ``X | Y``. "
"This provides a cleaner way of expressing 'either type X or type Y' instead "
"of using :data:`typing.Union`, especially in type hints."
msgstr ""
msgid ""
"In previous versions of Python, to apply a type hint for functions accepting "
"arguments of multiple types, :data:`typing.Union` was used::"
msgstr ""
msgid ""
"def square(number: Union[int, float]) -> Union[int, float]:\n"
" return number ** 2"
msgstr ""
msgid "Type hints can now be written in a more succinct manner::"
msgstr ""
msgid ""
"def square(number: int | float) -> int | float:\n"
" return number ** 2"
msgstr ""
msgid ""
"This new syntax is also accepted as the second argument to :func:"
"`isinstance` and :func:`issubclass`::"
msgstr ""
msgid ""
">>> isinstance(1, int | str)\n"
"True"
msgstr ""
">>> isinstance(1, int | str)\n"
"True"
msgid "See :ref:`types-union` and :pep:`604` for more details."
msgstr ""
msgid ""
"(Contributed by Maggie Moss and Philippe Prados in :issue:`41428`, with "
"additions by Yurii Karabas and Serhiy Storchaka in :issue:`44490`.)"