-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy path3.8.po
4499 lines (3986 loc) · 201 KB
/
3.8.po
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-2025, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# 汇民 王 <whuim@qq.com>, 2021
# Kaizhao Zhang <zhangkaizhao@gmail.com>, 2021
# Alpha Du <alphanow@gmail.com>, 2021
# jacky <jackylvm@foxmail.com>, 2021
# Han YANG <yanghan.cs@outlook.com>, 2021
# ppcfish <ppcfish@gmail.com>, 2021
# WH-2099 <wh2099@outlook.com>, 2021
# Dai Xu <daixu61@hotmail.com>, 2024
# CatNeverCodes CNC <574469831@qq.com>, 2024
# Freesand Leo <yuqinju@163.com>, 2025
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-17 14:16+0000\n"
"PO-Revision-Date: 2021-06-29 13:04+0000\n"
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2025\n"
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../whatsnew/3.8.rst:3
msgid "What's New In Python 3.8"
msgstr "Python 3.8 有什么新变化"
#: ../../whatsnew/3.8.rst:0
msgid "Editor"
msgstr "编者"
#: ../../whatsnew/3.8.rst:45
msgid "Raymond Hettinger"
msgstr "Raymond Hettinger(译者:wh2099 at outlook dot com)"
#: ../../whatsnew/3.8.rst:47
msgid ""
"This article explains the new features in Python 3.8, compared to 3.7. "
"Python 3.8 was released on October 14, 2019. For full details, see the "
":ref:`changelog <changelog>`."
msgstr ""
"这篇文章介绍了 Python 3.8 相比 3.7 增加的新特性。 Python 3.8 发布于 2019 年 10 月 14 日。 更详细的信息可参阅"
" :ref:`更新日志 <changelog>`。"
#: ../../whatsnew/3.8.rst:61
msgid "Summary -- Release highlights"
msgstr "摘要 -- 发布重点"
#: ../../whatsnew/3.8.rst:72
msgid "New Features"
msgstr "新的特性"
#: ../../whatsnew/3.8.rst:75
msgid "Assignment expressions"
msgstr "赋值表达式"
#: ../../whatsnew/3.8.rst:77
msgid ""
"There is new syntax ``:=`` that assigns values to variables as part of a "
"larger expression. It is affectionately known as \"the walrus operator\" due"
" to its resemblance to `the eyes and tusks of a walrus "
"<https://en.wikipedia.org/wiki/Walrus#/media/File:Pacific_Walrus_-"
"_Bull_(8247646168).jpg>`_."
msgstr ""
"新增的语法 ``:=`` 可在表达式内部为变量赋值。 它被昵称为“海象运算符”因为它很像是 `海象的眼睛和长牙 "
"<https://en.wikipedia.org/wiki/Walrus#/media/File:Pacific_Walrus_-"
"_Bull_(8247646168).jpg>`_。"
#: ../../whatsnew/3.8.rst:82
msgid ""
"In this example, the assignment expression helps avoid calling :func:`len` "
"twice::"
msgstr "在这个示例中,赋值表达式可以避免调用 :func:`len` 两次::"
#: ../../whatsnew/3.8.rst:85
msgid ""
"if (n := len(a)) > 10:\n"
" print(f\"List is too long ({n} elements, expected <= 10)\")"
msgstr ""
"if (n := len(a)) > 10:\n"
" print(f\"List is too long ({n} elements, expected <= 10)\")"
#: ../../whatsnew/3.8.rst:88
msgid ""
"A similar benefit arises during regular expression matching where match "
"objects are needed twice, once to test whether a match occurred and another "
"to extract a subgroup::"
msgstr "类似的益处还可出现在正则表达式匹配中需要使用两次匹配对象的情况中,一次检测用于匹配是否发生,另一次用于提取子分组::"
#: ../../whatsnew/3.8.rst:92
msgid ""
"discount = 0.0\n"
"if (mo := re.search(r'(\\d+)% discount', advertisement)):\n"
" discount = float(mo.group(1)) / 100.0"
msgstr ""
"discount = 0.0\n"
"if (mo := re.search(r'(\\d+)% discount', advertisement)):\n"
" discount = float(mo.group(1)) / 100.0"
#: ../../whatsnew/3.8.rst:96
msgid ""
"The operator is also useful with while-loops that compute a value to test "
"loop termination and then need that same value again in the body of the "
"loop::"
msgstr "此运算符也适用于配合 while 循环计算一个值来检测循环是否终止,而同一个值又在循环体中再次被使用的情况::"
#: ../../whatsnew/3.8.rst:100
msgid ""
"# Loop over fixed length blocks\n"
"while (block := f.read(256)) != '':\n"
" process(block)"
msgstr ""
"# 循环处理固定长度的数据块\n"
"while (block := f.read(256)) != '':\n"
" process(block)"
#: ../../whatsnew/3.8.rst:104
msgid ""
"Another motivating use case arises in list comprehensions where a value "
"computed in a filtering condition is also needed in the expression body::"
msgstr "另一个值得介绍的用例出现于列表推导式中,在筛选条件中计算一个值,而同一个值又在表达式中需要被使用::"
#: ../../whatsnew/3.8.rst:108
msgid ""
"[clean_name.title() for name in names\n"
" if (clean_name := normalize('NFC', name)) in allowed_names]"
msgstr ""
"[clean_name.title() for name in names\n"
" if (clean_name := normalize('NFC', name)) in allowed_names]"
#: ../../whatsnew/3.8.rst:111
msgid ""
"Try to limit use of the walrus operator to clean cases that reduce "
"complexity and improve readability."
msgstr "请尽量将海象运算符的使用限制在清晰的场合中,以降低复杂性并提升可读性。"
#: ../../whatsnew/3.8.rst:114
msgid "See :pep:`572` for a full description."
msgstr "请参阅 :pep:`572` 了解详情。"
#: ../../whatsnew/3.8.rst:116
msgid "(Contributed by Emily Morehouse in :issue:`35224`.)"
msgstr "(由 Morehouse 在 :issue:`35224` 中贡献。)"
#: ../../whatsnew/3.8.rst:120
msgid "Positional-only parameters"
msgstr "仅限位置形参"
#: ../../whatsnew/3.8.rst:122
msgid ""
"There is a new function parameter syntax ``/`` to indicate that some "
"function parameters must be specified positionally and cannot be used as "
"keyword arguments. This is the same notation shown by ``help()`` for C "
"functions annotated with Larry Hastings' `Argument Clinic "
"<https://devguide.python.org/development-tools/clinic/>`__ tool."
msgstr ""
"新增了一个函数形参语法 ``/`` 用来指明某些函数形参必须作为位置参数而不可作为关键字参数。 这种标记语法与通过 ``help()`` 显示的使用 "
"Larry Hastings 的 `Argument Clinic <https://devguide.python.org/development-"
"tools/clinic/>`__ 工具所标记的 C 函数相同。"
#: ../../whatsnew/3.8.rst:128
msgid ""
"In the following example, parameters *a* and *b* are positional-only, while "
"*c* or *d* can be positional or keyword, and *e* or *f* are required to be "
"keywords::"
msgstr ""
"在下面的例子中,形参 *a* 和 *b* 为仅限位置形参,*c* 或 *d* 可以是位置形参或关键字形参,而 *e* 或 *f* 要求为关键字形参::"
#: ../../whatsnew/3.8.rst:132
msgid ""
"def f(a, b, /, c, d, *, e, f):\n"
" print(a, b, c, d, e, f)"
msgstr ""
"def f(a, b, /, c, d, *, e, f):\n"
" print(a, b, c, d, e, f)"
#: ../../whatsnew/3.8.rst:135
msgid "The following is a valid call::"
msgstr "以下均为合法的调用::"
#: ../../whatsnew/3.8.rst:137
msgid "f(10, 20, 30, d=40, e=50, f=60)"
msgstr "f(10, 20, 30, d=40, e=50, f=60)"
#: ../../whatsnew/3.8.rst:139
msgid "However, these are invalid calls::"
msgstr "但是,以下均为不合法的调用::"
#: ../../whatsnew/3.8.rst:141
msgid ""
"f(10, b=20, c=30, d=40, e=50, f=60) # b cannot be a keyword argument\n"
"f(10, 20, 30, 40, 50, f=60) # e must be a keyword argument"
msgstr ""
"f(10, b=20, c=30, d=40, e=50, f=60) # b 不能是关键字参数\n"
"f(10, 20, 30, 40, 50, f=60) # e 必须是关键字参数"
#: ../../whatsnew/3.8.rst:144
msgid ""
"One use case for this notation is that it allows pure Python functions to "
"fully emulate behaviors of existing C coded functions. For example, the "
"built-in :func:`divmod` function does not accept keyword arguments::"
msgstr ""
"这种标记形式的一个用例是它允许纯 Python 函数完整模拟现有的用 C 代码编写的函数的行为。 例如,内置的 :func:`divmod` "
"函数不接受关键字参数::"
#: ../../whatsnew/3.8.rst:148
msgid ""
"def divmod(a, b, /):\n"
" \"Emulate the built in divmod() function\"\n"
" return (a // b, a % b)"
msgstr ""
"def divmod(a, b, /):\n"
" \"Emulate the built in divmod() function\"\n"
" return (a // b, a % b)"
#: ../../whatsnew/3.8.rst:152
msgid ""
"Another use case is to preclude keyword arguments when the parameter name is"
" not helpful. For example, the builtin :func:`len` function has the "
"signature ``len(obj, /)``. This precludes awkward calls such as::"
msgstr ""
"另一个用例是在不需要形参名称时排除关键字参数。 例如,内置的 :func:`len` 函数的签名为 ``len(obj, /)``。 "
"这可以排除如下这种笨拙的调用形式::"
#: ../../whatsnew/3.8.rst:156
msgid "len(obj='hello') # The \"obj\" keyword argument impairs readability"
msgstr "len(obj='hello') # \"obj\" 关键字参数损害了可读性"
#: ../../whatsnew/3.8.rst:158
msgid ""
"A further benefit of marking a parameter as positional-only is that it "
"allows the parameter name to be changed in the future without risk of "
"breaking client code. For example, in the :mod:`statistics` module, the "
"parameter name *dist* may be changed in the future. This was made possible "
"with the following function specification::"
msgstr ""
"另一个益处是将形参标记为仅限位置形参将允许在未来修改形参名而不会破坏客户的代码。 例如,在 :mod:`statistics` 模块中,形参名 "
"*dist* 在未来可能被修改。 这使得以下函数描述成为可能::"
#: ../../whatsnew/3.8.rst:164
msgid ""
"def quantiles(dist, /, *, n=4, method='exclusive')\n"
" ..."
msgstr ""
"def quantiles(dist, /, *, n=4, method='exclusive')\n"
" ..."
#: ../../whatsnew/3.8.rst:167
msgid ""
"Since the parameters to the left of ``/`` are not exposed as possible "
"keywords, the parameters names remain available for use in ``**kwargs``::"
msgstr "由于在 ``/`` 左侧的形参不会被公开为可用关键字,其他形参名仍可在 ``**kwargs`` 中使用::"
#: ../../whatsnew/3.8.rst:170
msgid ""
">>> def f(a, b, /, **kwargs):\n"
"... print(a, b, kwargs)\n"
"...\n"
">>> f(10, 20, a=1, b=2, c=3) # a and b are used in two ways\n"
"10 20 {'a': 1, 'b': 2, 'c': 3}"
msgstr ""
">>> def f(a, b, /, **kwargs):\n"
"... print(a, b, kwargs)\n"
"...\n"
">>> f(10, 20, a=1, b=2, c=3) # a 和 b 以两种方式被使用\n"
"10 20 {'a': 1, 'b': 2, 'c': 3}"
#: ../../whatsnew/3.8.rst:176
msgid ""
"This greatly simplifies the implementation of functions and methods that "
"need to accept arbitrary keyword arguments. For example, here is an excerpt"
" from code in the :mod:`collections` module::"
msgstr "这极大地简化了需要接受任意关键字参数的函数和方法的实现。 例如,以下是一段摘自 :mod:`collections` 模块的代码::"
#: ../../whatsnew/3.8.rst:180
msgid ""
"class Counter(dict):\n"
"\n"
" def __init__(self, iterable=None, /, **kwds):\n"
" # Note \"iterable\" is a possible keyword argument"
msgstr ""
"class Counter(dict):\n"
"\n"
" def __init__(self, iterable=None, /, **kwds):\n"
" # 请注意 \"iterable\" 可以是关键字参数"
#: ../../whatsnew/3.8.rst:185
msgid "See :pep:`570` for a full description."
msgstr "请参阅 :pep:`570` 了解详情。"
#: ../../whatsnew/3.8.rst:187
msgid "(Contributed by Pablo Galindo in :issue:`36540`.)"
msgstr "(由 Pablo Galindo 在 :issue:`36540` 中贡献。)"
#: ../../whatsnew/3.8.rst:193
msgid "Parallel filesystem cache for compiled bytecode files"
msgstr "用于已编译字节码文件的并行文件系统缓存"
#: ../../whatsnew/3.8.rst:195
msgid ""
"The new :envvar:`PYTHONPYCACHEPREFIX` setting (also available as "
":option:`-X` ``pycache_prefix``) configures the implicit bytecode cache to "
"use a separate parallel filesystem tree, rather than the default "
"``__pycache__`` subdirectories within each source directory."
msgstr ""
"新增的 :envvar:`PYTHONPYCACHEPREFIX` 设置 (也可使用 :option:`-X` ``pycache_prefix``) "
"可将隐式的字节码缓存配置为使用单独的并行文件系统树,而不是默认的每个源代码目录下的 ``__pycache__`` 子目录。"
#: ../../whatsnew/3.8.rst:201
msgid ""
"The location of the cache is reported in :data:`sys.pycache_prefix` "
"(:const:`None` indicates the default location in ``__pycache__`` "
"subdirectories)."
msgstr ""
"缓存的位置会在 :data:`sys.pycache_prefix` 中报告 (:const:`None` 表示默认位置即 "
"``__pycache__`` 子目录)。"
#: ../../whatsnew/3.8.rst:205
msgid "(Contributed by Carl Meyer in :issue:`33499`.)"
msgstr "(由 Carl Meyer 在 :issue:`33499` 中贡献。)"
#: ../../whatsnew/3.8.rst:209
msgid "Debug build uses the same ABI as release build"
msgstr "调试构建使用与发布构建相同的 ABI"
#: ../../whatsnew/3.8.rst:211
msgid ""
"Python now uses the same ABI whether it's built in release or debug mode. On"
" Unix, when Python is built in debug mode, it is now possible to load C "
"extensions built in release mode and C extensions built using the stable "
"ABI."
msgstr ""
"Python 现在不论是以发布模式还是调试模式进行构建都将使用相同的 ABI。 在 Unix 上,当 Python "
"以调试模式构建时,现在将可以加载以发布模式构建的 C 扩展和使用稳定版 ABI 构建的 C 扩展。"
#: ../../whatsnew/3.8.rst:215
msgid ""
"Release builds and :ref:`debug builds <debug-build>` are now ABI compatible:"
" defining the ``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` "
"macro, which introduces the only ABI incompatibility. The ``Py_TRACE_REFS`` "
"macro, which adds the :func:`sys.getobjects` function and the "
":envvar:`PYTHONDUMPREFS` environment variable, can be set using the new "
":option:`./configure --with-trace-refs <--with-trace-refs>` build option. "
"(Contributed by Victor Stinner in :issue:`36465`.)"
msgstr ""
"发布编译版和 :ref:`调试编译版 <debug-build>` 现在都是 ABI 兼容的:定义 ``Py_DEBUG`` 宏不会再应用 "
"``Py_TRACE_REFS`` 宏,它引入 了唯一的 ABI 不兼容性。 ``Py_TRACE_REFS`` 宏添加了 "
":func:`sys.getobjects` 函数和 :envvar:`PYTHONDUMPREFS` 环境变量,它可以使用新的 "
":option:`./configure --with-trace-refs <--with-trace-refs>` 编译选项来设置。 (由 "
"Victor Stinner 在 :issue:`36465` 中贡献。)"
#: ../../whatsnew/3.8.rst:223
msgid ""
"On Unix, C extensions are no longer linked to libpython except on Android "
"and Cygwin. It is now possible for a statically linked Python to load a C "
"extension built using a shared library Python. (Contributed by Victor "
"Stinner in :issue:`21536`.)"
msgstr ""
"在 Unix 上,C 扩展不会再被链接到 libpython,但 Android 和 Cygwin 例外。 现在静态链接的 Python "
"将可以加载使用共享库 Python 构建的 C 扩展。 (由 Victor Stinner 在 :issue:`21536` 中贡献。)"
#: ../../whatsnew/3.8.rst:230
msgid ""
"On Unix, when Python is built in debug mode, import now also looks for C "
"extensions compiled in release mode and for C extensions compiled with the "
"stable ABI. (Contributed by Victor Stinner in :issue:`36722`.)"
msgstr ""
"在 Unix 上,当 Python 以调试模式构建时,导入操作现在也会查找在发布模式下编译的 C 扩展以及使用稳定版 ABI 编译的 C 扩展。 (由 "
"Victor Stinner 在 :issue:`36722` 中贡献。)"
#: ../../whatsnew/3.8.rst:235
msgid ""
"To embed Python into an application, a new ``--embed`` option must be passed"
" to ``python3-config --libs --embed`` to get ``-lpython3.8`` (link the "
"application to libpython). To support both 3.8 and older, try "
"``python3-config --libs --embed`` first and fallback to ``python3-config "
"--libs`` (without ``--embed``) if the previous command fails."
msgstr ""
"要将 Python 嵌入到一个应用中,必须将新增的 ``--embed`` 选项传给 ``python3-config --libs --embed``"
" 以获得 ``-lpython3.8`` (将应用链接到 libpython)。 要同时支持 3.8 和旧版本,请先尝试 "
"``python3-config --libs --embed`` 并在此命令失败时回退到 ``python3-config --libs`` (即不带"
" ``--embed``)。"
#: ../../whatsnew/3.8.rst:241
msgid ""
"Add a pkg-config ``python-3.8-embed`` module to embed Python into an "
"application: ``pkg-config python-3.8-embed --libs`` includes "
"``-lpython3.8``. To support both 3.8 and older, try ``pkg-config "
"python-X.Y-embed --libs`` first and fallback to ``pkg-config python-X.Y "
"--libs`` (without ``--embed``) if the previous command fails (replace "
"``X.Y`` with the Python version)."
msgstr ""
"增加一个 pkg-config ``python-3.8-embed`` 模块用来将 Python 嵌入到一个应用中: ``pkg-config "
"python-3.8-embed --libs`` 包含 ``-lpython3.8``。 要同时支持 3.8 和旧版本,请先尝试 ``pkg-"
"config python-X.Y-embed --libs`` 并在此命令失败时回退到 ``pkg-config python-X.Y "
"--libs`` (即不带 ``--embed``) (请将 ``X.Y`` 替换为 Python 版本号)。"
#: ../../whatsnew/3.8.rst:247
msgid ""
"On the other hand, ``pkg-config python3.8 --libs`` no longer contains "
"``-lpython3.8``. C extensions must not be linked to libpython (except on "
"Android and Cygwin, whose cases are handled by the script); this change is "
"backward incompatible on purpose. (Contributed by Victor Stinner in "
":issue:`36721`.)"
msgstr ""
"另一方面,``pkg-config python3.8 --libs`` 不再包含 ``-lpython3.8``。 C 扩展不可被链接到 "
"libpython (但 Android 和 Cygwin 例外,这两者的情况由脚本处理);此改变是故意被设为向下不兼容的。 (由 Victor "
"Stinner 在 :issue:`36721` 中贡献。)"
#: ../../whatsnew/3.8.rst:256
msgid "f-strings support ``=`` for self-documenting expressions and debugging"
msgstr "f-字符串支持 ``=`` 用于自动记录表达式和调试文档"
#: ../../whatsnew/3.8.rst:258
msgid ""
"Added an ``=`` specifier to :term:`f-string`\\s. An f-string such as "
"``f'{expr=}'`` will expand to the text of the expression, an equal sign, "
"then the representation of the evaluated expression. For example:"
msgstr ""
"增加 ``=`` 说明符用于 :term:`f-string`。 形式为 ``f'{expr=}'`` 的 "
"f-字符串将扩展表示为表达式文本,加一个等于号,再加表达式的求值结果。 例如:"
#: ../../whatsnew/3.8.rst:267
msgid ""
"The usual :ref:`f-string format specifiers <f-strings>` allow more control "
"over how the result of the expression is displayed::"
msgstr "通常的 :ref:`f-字符串格式说明符 <f-strings>` 允许更细致地控制所要显示的表达式结果::"
#: ../../whatsnew/3.8.rst:270
msgid ""
">>> delta = date.today() - member_since\n"
">>> f'{user=!s} {delta.days=:,d}'\n"
"'user=eric_idle delta.days=16,075'"
msgstr ""
">>> delta = date.today() - member_since\n"
">>> f'{user=!s} {delta.days=:,d}'\n"
"'user=eric_idle delta.days=16,075'"
#: ../../whatsnew/3.8.rst:274
msgid ""
"The ``=`` specifier will display the whole expression so that calculations "
"can be shown::"
msgstr "``=`` 说明符将输出整个表达式,以便详细演示计算过程::"
#: ../../whatsnew/3.8.rst:277
msgid ""
">>> print(f'{theta=} {cos(radians(theta))=:.3f}')\n"
"theta=30 cos(radians(theta))=0.866"
msgstr ""
">>> print(f'{theta=} {cos(radians(theta))=:.3f}')\n"
"theta=30 cos(radians(theta))=0.866"
#: ../../whatsnew/3.8.rst:280
msgid "(Contributed by Eric V. Smith and Larry Hastings in :issue:`36817`.)"
msgstr "(由 Eric V. Smith 和 Larry Hastings 在 :issue:`36817` 中贡献。)"
#: ../../whatsnew/3.8.rst:284
msgid "PEP 578: Python Runtime Audit Hooks"
msgstr "PEP 578: Python 运行时审核钩子"
#: ../../whatsnew/3.8.rst:286
msgid ""
"The PEP adds an Audit Hook and Verified Open Hook. Both are available from "
"Python and native code, allowing applications and frameworks written in pure"
" Python code to take advantage of extra notifications, while also allowing "
"embedders or system administrators to deploy builds of Python where auditing"
" is always enabled."
msgstr ""
"此 PEP 添加了审核钩子和已验证开放钩子。 两者在 Python 与本机代码中均可用。允许以纯 Python "
"代码编写的应用和框架利用额外的通知,同时允许嵌入开发人员或系统管理员部署始终启用审核的 Python 版本。"
#: ../../whatsnew/3.8.rst:292
msgid "See :pep:`578` for full details."
msgstr "请参阅 :pep:`578` 了解详情。"
#: ../../whatsnew/3.8.rst:296
msgid "PEP 587: Python Initialization Configuration"
msgstr "PEP 587: Python 初始化配置"
#: ../../whatsnew/3.8.rst:298
msgid ""
"The :pep:`587` adds a new C API to configure the Python Initialization "
"providing finer control on the whole configuration and better error "
"reporting."
msgstr ":pep:`587` 增加了一个新的 C API 用来配置 Python 初始化,提供对整个配置过程的更细致控制以及更好的错误报告。"
#: ../../whatsnew/3.8.rst:301
msgid "New structures:"
msgstr "新的结构:"
#: ../../whatsnew/3.8.rst:303
msgid ":c:type:`PyConfig`"
msgstr ":c:type:`PyConfig`"
#: ../../whatsnew/3.8.rst:304
msgid ":c:type:`PyPreConfig`"
msgstr ":c:type:`PyPreConfig`"
#: ../../whatsnew/3.8.rst:305
msgid ":c:type:`PyStatus`"
msgstr ":c:type:`PyStatus`"
#: ../../whatsnew/3.8.rst:306
msgid ":c:type:`PyWideStringList`"
msgstr ":c:type:`PyWideStringList`"
#: ../../whatsnew/3.8.rst:308
msgid "New functions:"
msgstr "新的函数:"
#: ../../whatsnew/3.8.rst:310
msgid ":c:func:`PyConfig_Clear`"
msgstr ":c:func:`PyConfig_Clear`"
#: ../../whatsnew/3.8.rst:311
msgid ":c:func:`PyConfig_InitIsolatedConfig`"
msgstr ":c:func:`PyConfig_InitIsolatedConfig`"
#: ../../whatsnew/3.8.rst:312
msgid ":c:func:`PyConfig_InitPythonConfig`"
msgstr ":c:func:`PyConfig_InitPythonConfig`"
#: ../../whatsnew/3.8.rst:313
msgid ":c:func:`PyConfig_Read`"
msgstr ":c:func:`PyConfig_Read`"
#: ../../whatsnew/3.8.rst:314
msgid ":c:func:`PyConfig_SetArgv`"
msgstr ":c:func:`PyConfig_SetArgv`"
#: ../../whatsnew/3.8.rst:315
msgid ":c:func:`PyConfig_SetBytesArgv`"
msgstr ":c:func:`PyConfig_SetBytesArgv`"
#: ../../whatsnew/3.8.rst:316
msgid ":c:func:`PyConfig_SetBytesString`"
msgstr ":c:func:`PyConfig_SetBytesString`"
#: ../../whatsnew/3.8.rst:317
msgid ":c:func:`PyConfig_SetString`"
msgstr ":c:func:`PyConfig_SetString`"
#: ../../whatsnew/3.8.rst:318
msgid ":c:func:`PyPreConfig_InitIsolatedConfig`"
msgstr ":c:func:`PyPreConfig_InitIsolatedConfig`"
#: ../../whatsnew/3.8.rst:319
msgid ":c:func:`PyPreConfig_InitPythonConfig`"
msgstr ":c:func:`PyPreConfig_InitPythonConfig`"
#: ../../whatsnew/3.8.rst:320
msgid ":c:func:`PyStatus_Error`"
msgstr ":c:func:`PyStatus_Error`"
#: ../../whatsnew/3.8.rst:321
msgid ":c:func:`PyStatus_Exception`"
msgstr ":c:func:`PyStatus_Exception`"
#: ../../whatsnew/3.8.rst:322
msgid ":c:func:`PyStatus_Exit`"
msgstr ":c:func:`PyStatus_Exit`"
#: ../../whatsnew/3.8.rst:323
msgid ":c:func:`PyStatus_IsError`"
msgstr ":c:func:`PyStatus_IsError`"
#: ../../whatsnew/3.8.rst:324
msgid ":c:func:`PyStatus_IsExit`"
msgstr ":c:func:`PyStatus_IsExit`"
#: ../../whatsnew/3.8.rst:325
msgid ":c:func:`PyStatus_NoMemory`"
msgstr ":c:func:`PyStatus_NoMemory`"
#: ../../whatsnew/3.8.rst:326
msgid ":c:func:`PyStatus_Ok`"
msgstr ":c:func:`PyStatus_Ok`"
#: ../../whatsnew/3.8.rst:327
msgid ":c:func:`PyWideStringList_Append`"
msgstr ":c:func:`PyWideStringList_Append`"
#: ../../whatsnew/3.8.rst:328
msgid ":c:func:`PyWideStringList_Insert`"
msgstr ":c:func:`PyWideStringList_Insert`"
#: ../../whatsnew/3.8.rst:329
msgid ":c:func:`Py_BytesMain`"
msgstr ":c:func:`Py_BytesMain`"
#: ../../whatsnew/3.8.rst:330
msgid ":c:func:`Py_ExitStatusException`"
msgstr ":c:func:`Py_ExitStatusException`"
#: ../../whatsnew/3.8.rst:331
msgid ":c:func:`Py_InitializeFromConfig`"
msgstr ":c:func:`Py_InitializeFromConfig`"
#: ../../whatsnew/3.8.rst:332
msgid ":c:func:`Py_PreInitialize`"
msgstr ":c:func:`Py_PreInitialize`"
#: ../../whatsnew/3.8.rst:333
msgid ":c:func:`Py_PreInitializeFromArgs`"
msgstr ":c:func:`Py_PreInitializeFromArgs`"
#: ../../whatsnew/3.8.rst:334
msgid ":c:func:`Py_PreInitializeFromBytesArgs`"
msgstr ":c:func:`Py_PreInitializeFromBytesArgs`"
#: ../../whatsnew/3.8.rst:335
msgid ":c:func:`Py_RunMain`"
msgstr ":c:func:`Py_RunMain`"
#: ../../whatsnew/3.8.rst:337
msgid ""
"This PEP also adds ``_PyRuntimeState.preconfig`` (:c:type:`PyPreConfig` "
"type) and ``PyInterpreterState.config`` (:c:type:`PyConfig` type) fields to "
"these internal structures. ``PyInterpreterState.config`` becomes the new "
"reference configuration, replacing global configuration variables and other "
"private variables."
msgstr ""
"此 PEP 还为这些内部结构添加了 ``_PyRuntimeState.preconfig`` (:c:type:`PyPreConfig` 类型) 和"
" ``PyInterpreterState.config`` (:c:type:`PyConfig` 类型) 字段。 "
"``PyInterpreterState.config`` 成为新的引用配置,替代全局配置变量和其他私有变量。"
#: ../../whatsnew/3.8.rst:343
msgid ""
"See :ref:`Python Initialization Configuration <init-config>` for the "
"documentation."
msgstr "请参阅 :ref:`Python 初始化配置 <init-config>` 获取详细文档。"
#: ../../whatsnew/3.8.rst:346
msgid "See :pep:`587` for a full description."
msgstr "请参阅 :pep:`587` 了解详情。"
#: ../../whatsnew/3.8.rst:348
msgid "(Contributed by Victor Stinner in :issue:`36763`.)"
msgstr "(由 Victor Stinner 在 :issue:`36763` 中贡献。)"
#: ../../whatsnew/3.8.rst:352
msgid "PEP 590: Vectorcall: a fast calling protocol for CPython"
msgstr "PEP 590: Vectorcall: 用于 CPython 的快速调用协议"
#: ../../whatsnew/3.8.rst:354
msgid ""
":ref:`vectorcall` is added to the Python/C API. It is meant to formalize "
"existing optimizations which were already done for various classes. Any "
":ref:`static type <static-types>` implementing a callable can use this "
"protocol."
msgstr ""
"将 :ref:`vectorcall` 添加到 Python/C API。 它的目标是对已被应用于多个类的现有优先进行正式化。 任何实现了可调用对象的 "
":ref:`静态类型 <static-types>` 均可使用此协议。"
#: ../../whatsnew/3.8.rst:360
msgid ""
"This is currently provisional. The aim is to make it fully public in Python "
"3.9."
msgstr "此特性目前为暂定状态,计划在 Python 3.9 将其完全公开。"
#: ../../whatsnew/3.8.rst:363
msgid "See :pep:`590` for a full description."
msgstr "请参阅 :pep:`590` 了解详情。"
#: ../../whatsnew/3.8.rst:365
msgid ""
"(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin in "
":issue:`36974`.)"
msgstr ""
"(由 Jeroen Demeyer, Mark Shannon 和 Petr Viktorin 在 :issue:`36974` 中贡献。)"
#: ../../whatsnew/3.8.rst:369
msgid "Pickle protocol 5 with out-of-band data buffers"
msgstr "具有外部数据缓冲区的 pickle 协议 5"
#: ../../whatsnew/3.8.rst:371
msgid ""
"When :mod:`pickle` is used to transfer large data between Python processes "
"in order to take advantage of multi-core or multi-machine processing, it is "
"important to optimize the transfer by reducing memory copies, and possibly "
"by applying custom techniques such as data-dependent compression."
msgstr ""
"当使用 :mod:`pickle` 在 Python "
"进程间传输大量数据以充分发挥多核或多机处理的优势时,非常重要一点是通过减少内存拷贝来优化传输效率,并可能应用一些定制技巧例如针对特定数据的压缩。"
#: ../../whatsnew/3.8.rst:376
msgid ""
"The :mod:`pickle` protocol 5 introduces support for out-of-band buffers "
"where :pep:`3118`-compatible data can be transmitted separately from the "
"main pickle stream, at the discretion of the communication layer."
msgstr ""
":mod:`pickle` 协议 5 引入了对于外部缓冲区的支持,这样 :pep:`3118` 兼容的数据可以与主 pickle "
"流分开进行传输,这是由通信层来确定的。"
#: ../../whatsnew/3.8.rst:380
msgid "See :pep:`574` for a full description."
msgstr "请参阅 :pep:`574` 了解详情。"
#: ../../whatsnew/3.8.rst:382
msgid "(Contributed by Antoine Pitrou in :issue:`36785`.)"
msgstr "(由 Antoine Pitrou 在 :issue:`36785` 中贡献。)"
#: ../../whatsnew/3.8.rst:386
msgid "Other Language Changes"
msgstr "其他语言特性修改"
#: ../../whatsnew/3.8.rst:388
msgid ""
"A :keyword:`continue` statement was illegal in the :keyword:`finally` clause"
" due to a problem with the implementation. In Python 3.8 this restriction "
"was lifted. (Contributed by Serhiy Storchaka in :issue:`32489`.)"
msgstr ""
"在之前版本中 :keyword:`continue` 语句不允许在 :keyword:`finally` 子句中使用,这是因为具体实现存在一个问题。 在"
" Python 3.8 中此限制已被取消。 (由 Serhiy Storchaka 在 :issue:`32489` 中贡献。)"
#: ../../whatsnew/3.8.rst:393
msgid ""
"The :class:`bool`, :class:`int`, and :class:`fractions.Fraction` types now "
"have an :meth:`~int.as_integer_ratio` method like that found in "
":class:`float` and :class:`decimal.Decimal`. This minor API extension makes"
" it possible to write ``numerator, denominator = x.as_integer_ratio()`` and "
"have it work across multiple numeric types. (Contributed by Lisa Roach in "
":issue:`33073` and Raymond Hettinger in :issue:`37819`.)"
msgstr ""
":class:`bool`, :class:`int` 和 :class:`fractions.Fraction` 类型现在都有一个 "
":meth:`~int.as_integer_ratio` 方法,与 :class:`float` 和 :class:`decimal.Decimal`"
" 中的已有方法类似。 这个微小的 API 扩展使得 ``numerator, denominator = x.as_integer_ratio()`` "
"这样的写法在多种数字类型上通用成为可能。 (由 Lisa Roach 在 :issue:`33073` 和 Raymond Hettinger 在 "
":issue:`37819` 中贡献。)"
#: ../../whatsnew/3.8.rst:401
msgid ""
"Constructors of :class:`int`, :class:`float` and :class:`complex` will now "
"use the :meth:`~object.__index__` special method, if available and the "
"corresponding method :meth:`~object.__int__`, :meth:`~object.__float__` or "
":meth:`~object.__complex__` is not available. (Contributed by Serhiy "
"Storchaka in :issue:`20092`.)"
msgstr ""
":class:`int`, :class:`float` 和 :class:`complex` 的构造器现在会使用 "
":meth:`~object.__index__` 特殊方法,如果该方法可用而对应的方法 method :meth:`~object.__int__`,"
" :meth:`~object.__float__` 或 :meth:`~object.__complex__` 方法不可用的话。 (由 Serhiy "
"Storchaka 在 :issue:`20092` 中贡献。)"
#: ../../whatsnew/3.8.rst:407
msgid ""
"Added support of :samp:`\\\\N\\\\{{name}\\\\}` escapes in :mod:`regular "
"expressions <re>`::"
msgstr "在 :mod:`正则表达式 <re>`: 中添加了对 :samp:`\\\\N\\\\{{name}\\\\}` 转义码的支持::"
#: ../../whatsnew/3.8.rst:409
msgid ""
">>> notice = 'Copyright © 2019'\n"
">>> copyright_year_pattern = re.compile(r'\\N{copyright sign}\\s*(\\d{4})')\n"
">>> int(copyright_year_pattern.search(notice).group(1))\n"
"2019"
msgstr ""
">>> notice = 'Copyright © 2019'\n"
">>> copyright_year_pattern = re.compile(r'\\N{copyright sign}\\s*(\\d{4})')\n"
">>> int(copyright_year_pattern.search(notice).group(1))\n"
"2019"
#: ../../whatsnew/3.8.rst:414
msgid ""
"(Contributed by Jonathan Eunice and Serhiy Storchaka in :issue:`30688`.)"
msgstr "(由 Jonathan Eunice 和 Serhiy Storchaka 在 :issue:`30688` 中贡献。)"
#: ../../whatsnew/3.8.rst:416
msgid ""
"Dict and dictviews are now iterable in reversed insertion order using "
":func:`reversed`. (Contributed by Rémi Lapeyre in :issue:`33462`.)"
msgstr ""
"现在 dict 和 dictview 可以使用 :func:`reversed` 按插入顺序反向迭代。 (由 Rémi Lapeyre 在 "
":issue:`33462` 中贡献。)"
#: ../../whatsnew/3.8.rst:419
msgid ""
"The syntax allowed for keyword names in function calls was further "
"restricted. In particular, ``f((keyword)=arg)`` is no longer allowed. It was"
" never intended to permit more than a bare name on the left-hand side of a "
"keyword argument assignment term. (Contributed by Benjamin Peterson in "
":issue:`34641`.)"
msgstr ""
"在函数调用中允许使用的关键字名称语法受到进一步的限制。 特别地,``f((keyword)=arg)`` 不再被允许。 "
"关键字参数赋值形式的左侧绝不允许一般标识符以外的其他内容。 (由 Benjamin Peterson 在 :issue:`34641` 中贡献。)"
#: ../../whatsnew/3.8.rst:425
msgid ""
"Generalized iterable unpacking in :keyword:`yield` and :keyword:`return` "
"statements no longer requires enclosing parentheses. This brings the *yield*"
" and *return* syntax into better agreement with normal assignment syntax::"
msgstr ""
"在 :keyword:`yield` 和 :keyword:`return` 语句中的一般可迭代对象解包不再要求加圆括号。 这使得 *yield* 和 "
"*return* 的语法与正常的赋值语法更为一致::"
#: ../../whatsnew/3.8.rst:430
msgid ""
">>> def parse(family):\n"
" lastname, *members = family.split()\n"
" return lastname.upper(), *members\n"
"\n"
">>> parse('simpsons homer marge bart lisa maggie')\n"
"('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie')"
msgstr ""
">>> def parse(family):\n"
" lastname, *members = family.split()\n"
" return lastname.upper(), *members\n"
"\n"
">>> parse('simpsons homer marge bart lisa maggie')\n"
"('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie')"
#: ../../whatsnew/3.8.rst:437
msgid "(Contributed by David Cuthbert and Jordan Chapman in :issue:`32117`.)"
msgstr "(由 David Cuthbert 和 Jordan Chapman 在 :issue:`32117` 中贡献。)"
#: ../../whatsnew/3.8.rst:439
msgid ""
"When a comma is missed in code such as ``[(10, 20) (30, 40)]``, the compiler"
" displays a :exc:`SyntaxWarning` with a helpful suggestion. This improves on"
" just having a :exc:`TypeError` indicating that the first tuple was not "
"callable. (Contributed by Serhiy Storchaka in :issue:`15248`.)"
msgstr ""
"当类似 ``[(10, 20) (30, 40)]`` 这样在代码中少了一个逗号时,编译器将显示 :exc:`SyntaxWarning` "
"并附带更有帮助的提示。 这相比原来用 :exc:`TypeError` 来提示第一个元组是不可调用的更容易被理解。 (由 Serhiy "
"Storchaka 在 :issue:`15248` 中贡献。)"
#: ../../whatsnew/3.8.rst:445
msgid ""
"Arithmetic operations between subclasses of :class:`datetime.date` or "
":class:`datetime.datetime` and :class:`datetime.timedelta` objects now "
"return an instance of the subclass, rather than the base class. This also "
"affects the return type of operations whose implementation (directly or "
"indirectly) uses :class:`datetime.timedelta` arithmetic, such as "
":meth:`~datetime.datetime.astimezone`. (Contributed by Paul Ganssle in "
":issue:`32417`.)"
msgstr ""
":class:`datetime.date` 或 :class:`datetime.datetime` 和 "
":class:`datetime.timedelta` 对象之间的算术运算现在将返回相应子类的实例而不是基类的实例。 "
"这也会影响到在具体实现中(直接或间接地)使用了 :class:`datetime.timedelta` 算术运算的返回类型,例如 "
":meth:`~datetime.datetime.astimezone`。 (由 Paul Ganssle 在 :issue:`32417` "
"中贡献。)"
#: ../../whatsnew/3.8.rst:453
msgid ""
"When the Python interpreter is interrupted by Ctrl-C (SIGINT) and the "
"resulting :exc:`KeyboardInterrupt` exception is not caught, the Python "
"process now exits via a SIGINT signal or with the correct exit code such "
"that the calling process can detect that it died due to a Ctrl-C. Shells on"
" POSIX and Windows use this to properly terminate scripts in interactive "
"sessions. (Contributed by Google via Gregory P. Smith in :issue:`1054041`.)"
msgstr ""
"当 Python 解释器通过 Ctrl-C (SIGINT) 被中断并且所产生的 :exc:`KeyboardInterrupt` "
"异常未被捕获,Python 进程现在会通过一个 SIGINT 信号或是使得唤起的进程能检测到它是由 Ctrl-C 操作杀死的正确退出代码来退出。 "
"POSIX 和 Windows 上的终端会相应地使用此代码在交互式会话中终止脚本。 (由 Google 的 Gregory P. Smith 在 "
":issue:`1054041` 中贡献。)"
#: ../../whatsnew/3.8.rst:460
msgid ""
"Some advanced styles of programming require updating the "
":class:`types.CodeType` object for an existing function. Since code objects"
" are immutable, a new code object needs to be created, one that is modeled "
"on the existing code object. With 19 parameters, this was somewhat tedious."
" Now, the new ``replace()`` method makes it possible to create a clone with"
" a few altered parameters."
msgstr ""
"某些高级编程风格要求为现有的函数更新 :class:`types.CodeType` 对象。 "
"由于代码对象是不可变的,需要基于现有代码对象模型创建一个新的代码对象。 使用 19 个形参将会相当繁琐。 现在,新的 ``replace()`` "
"方法使得通过少量修改的形参创建克隆对象成为可能。"
#: ../../whatsnew/3.8.rst:467
msgid ""
"Here's an example that alters the :func:`statistics.mean` function to "
"prevent the *data* parameter from being used as a keyword argument::"
msgstr "下面是一个修改 :func:`statistics.mean` 函数来防止 *data* 形参被用作关键字参数的例子::"
#: ../../whatsnew/3.8.rst:470
msgid ""
">>> from statistics import mean\n"
">>> mean(data=[10, 20, 90])\n"
"40\n"
">>> mean.__code__ = mean.__code__.replace(co_posonlyargcount=1)\n"
">>> mean(data=[10, 20, 90])\n"
"Traceback (most recent call last):\n"
" ...\n"
"TypeError: mean() got some positional-only arguments passed as keyword arguments: 'data'"
msgstr ""
">>> from statistics import mean\n"
">>> mean(data=[10, 20, 90])\n"
"40\n"
">>> mean.__code__ = mean.__code__.replace(co_posonlyargcount=1)\n"
">>> mean(data=[10, 20, 90])\n"
"Traceback (most recent call last):\n"
" ...\n"
"TypeError: mean() got some positional-only arguments passed as keyword arguments: 'data'"
#: ../../whatsnew/3.8.rst:479
msgid "(Contributed by Victor Stinner in :issue:`37032`.)"
msgstr "(由 Victor Stinner 在 :issue:`37032` 中贡献。)"
#: ../../whatsnew/3.8.rst:481
msgid ""
"For integers, the three-argument form of the :func:`pow` function now "
"permits the exponent to be negative in the case where the base is relatively"
" prime to the modulus. It then computes a modular inverse to the base when "
"the exponent is ``-1``, and a suitable power of that inverse for other "
"negative exponents. For example, to compute the `modular multiplicative "
"inverse <https://en.wikipedia.org/wiki/Modular_multiplicative_inverse>`_ of "
"38 modulo 137, write::"
msgstr ""
"对于整数,现在 :func:`pow` 函数的三参数形式在底数与模数不可约的情况下允许指数为负值。 随后它会在指数为 ``-1`` "
"时计算底数的模乘逆元,并对其他负指数计算反模的适当幂次。 例如,要计算 38 模 137 的 `模乘逆元 "
"<https://en.wikipedia.org/wiki/Modular_multiplicative_inverse>`_ 则可写为::"
#: ../../whatsnew/3.8.rst:490
msgid ""
">>> pow(38, -1, 137)\n"
"119\n"
">>> 119 * 38 % 137\n"
"1"
msgstr ""
">>> pow(38, -1, 137)\n"
"119\n"
">>> 119 * 38 % 137\n"
"1"
#: ../../whatsnew/3.8.rst:495
msgid ""
"Modular inverses arise in the solution of `linear Diophantine equations "
"<https://en.wikipedia.org/wiki/Diophantine_equation>`_. For example, to find"
" integer solutions for ``4258𝑥 + 147𝑦 = 369``, first rewrite as ``4258𝑥 ≡ "
"369 (mod 147)`` then solve:"
msgstr ""
"模乘逆元在求解 `线性丢番图方程 <https://en.wikipedia.org/wiki/Diophantine_equation>`_ "
"会被用到。 例如,想要求出 ``4258𝑥 + 147𝑦 = 369`` 的整数解,首先应重写为 ``4258𝑥 ≡ 369 (mod 147)`` "
"然后求解:"
#: ../../whatsnew/3.8.rst:505
msgid "(Contributed by Mark Dickinson in :issue:`36027`.)"
msgstr "(由 Mark Dickinson 在 :issue:`36027` 中贡献。)"
#: ../../whatsnew/3.8.rst:507
msgid ""
"Dict comprehensions have been synced-up with dict literals so that the key "
"is computed first and the value second::"
msgstr "字典推导式已与字典字面值实现同步,会先计算键再计算值::"
#: ../../whatsnew/3.8.rst:510
msgid ""
">>> # Dict comprehension\n"
">>> cast = {input('role? '): input('actor? ') for i in range(2)}\n"
"role? King Arthur\n"
"actor? Chapman\n"
"role? Black Knight\n"
"actor? Cleese\n"
"\n"
">>> # Dict literal\n"
">>> cast = {input('role? '): input('actor? ')}\n"
"role? Sir Robin\n"
"actor? Eric Idle"
msgstr ""
">>> # 字典推导式\n"
">>> cast = {input('role? '): input('actor? ') for i in range(2)}\n"
"role? King Arthur\n"
"actor? Chapman\n"
"role? Black Knight\n"
"actor? Cleese\n"
"\n"
">>> # 字典字面值\n"
">>> cast = {input('role? '): input('actor? ')}\n"
"role? Sir Robin\n"
"actor? Eric Idle"
#: ../../whatsnew/3.8.rst:522
msgid ""
"The guaranteed execution order is helpful with assignment expressions "
"because variables assigned in the key expression will be available in the "
"value expression::"
msgstr "对执行顺序的保证对赋值表达式来说很有用,因为在键表达式中赋值的变量将可在值表达式中被使用::"
#: ../../whatsnew/3.8.rst:526
msgid ""
">>> names = ['Martin von Löwis', 'Łukasz Langa', 'Walter Dörwald']\n"
">>> {(n := normalize('NFC', name)).casefold() : n for name in names}\n"
"{'martin von löwis': 'Martin von Löwis',\n"
" 'łukasz langa': 'Łukasz Langa',\n"
" 'walter dörwald': 'Walter Dörwald'}"
msgstr ""
">>> names = ['Martin von Löwis', 'Łukasz Langa', 'Walter Dörwald']\n"
">>> {(n := normalize('NFC', name)).casefold() : n for name in names}\n"
"{'martin von löwis': 'Martin von Löwis',\n"
" 'łukasz langa': 'Łukasz Langa',\n"
" 'walter dörwald': 'Walter Dörwald'}"