-
-
Notifications
You must be signed in to change notification settings - Fork 211
/
Copy path3.5.po
3994 lines (3416 loc) · 127 KB
/
3.5.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
# Copyright (C) 2001-2022, Python Software Foundation
# This file is distributed under the same license as the Python package.
#
# Translators:
# Liang-Bo Wang <[email protected]>, 2016
# Noah Chen <[email protected]>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-10 00:13+0000\n"
"PO-Revision-Date: 2018-05-23 16:20+0000\n"
"Last-Translator: Adrian Liaw <[email protected]>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../whatsnew/3.5.rst:3
msgid "What's New In Python 3.5"
msgstr "Python 3.4 有什麼新功能"
#: ../../whatsnew/3.5.rst:0
msgid "Editors"
msgstr "編輯者"
#: ../../whatsnew/3.5.rst:5
msgid "Elvis Pranskevichus <[email protected]>, Yury Selivanov <[email protected]>"
msgstr "Elvis Pranskevichus <[email protected]>, Yury Selivanov <[email protected]>"
#: ../../whatsnew/3.5.rst:47
msgid ""
"This article explains the new features in Python 3.5, compared to 3.4. "
"Python 3.5 was released on September 13, 2015. See the `changelog <https://"
"docs.python.org/3.5/whatsnew/changelog.html>`_ for a full list of changes."
msgstr ""
"本文介紹了 Python 3.5 與 3.4 相比多了哪些新功能。Python 3.1 已於 2015 年 9 "
"月 13 日發布。完整詳情請見 `changelog <https://docs.python.org/3.5/whatsnew/"
"changelog.html>`_。"
#: ../../whatsnew/3.5.rst:54
msgid ":pep:`478` - Python 3.5 Release Schedule"
msgstr ":pep:`478` - Python 3.5 發佈時程"
#: ../../whatsnew/3.5.rst:58
msgid "Summary -- Release highlights"
msgstr "發布重點摘要"
#: ../../whatsnew/3.5.rst:60
msgid "New syntax features:"
msgstr "新增語法特性:"
#: ../../whatsnew/3.5.rst:62
msgid ""
":ref:`PEP 492 <whatsnew-pep-492>`, coroutines with async and await syntax."
msgstr ""
#: ../../whatsnew/3.5.rst:63
msgid ""
":ref:`PEP 465 <whatsnew-pep-465>`, a new matrix multiplication operator: ``a "
"@ b``."
msgstr ""
#: ../../whatsnew/3.5.rst:64
msgid ""
":ref:`PEP 448 <whatsnew-pep-448>`, additional unpacking generalizations."
msgstr ""
#: ../../whatsnew/3.5.rst:67
msgid "New library modules:"
msgstr "新的函式庫模組:"
#: ../../whatsnew/3.5.rst:69
msgid ":mod:`typing`: :ref:`PEP 484 -- Type Hints <whatsnew-pep-484>`."
msgstr ""
#: ../../whatsnew/3.5.rst:70
msgid ""
":mod:`zipapp`: :ref:`PEP 441 Improving Python ZIP Application Support "
"<whatsnew-zipapp>`."
msgstr ""
#: ../../whatsnew/3.5.rst:74
msgid "New built-in features:"
msgstr "新的內建功能"
#: ../../whatsnew/3.5.rst:76
msgid ""
"``bytes % args``, ``bytearray % args``: :ref:`PEP 461 <whatsnew-pep-461>` -- "
"Adding ``%`` formatting to bytes and bytearray."
msgstr ""
#: ../../whatsnew/3.5.rst:79
msgid ""
"New :meth:`bytes.hex`, :meth:`bytearray.hex` and :meth:`memoryview.hex` "
"methods. (Contributed by Arnon Yaari in :issue:`9951`.)"
msgstr ""
#: ../../whatsnew/3.5.rst:82
msgid ""
":class:`memoryview` now supports tuple indexing (including multi-"
"dimensional). (Contributed by Antoine Pitrou in :issue:`23632`.)"
msgstr ""
#: ../../whatsnew/3.5.rst:85
msgid ""
"Generators have a new ``gi_yieldfrom`` attribute, which returns the object "
"being iterated by ``yield from`` expressions. (Contributed by Benno Leslie "
"and Yury Selivanov in :issue:`24450`.)"
msgstr ""
#: ../../whatsnew/3.5.rst:89
msgid ""
"A new :exc:`RecursionError` exception is now raised when maximum recursion "
"depth is reached. (Contributed by Georg Brandl in :issue:`19235`.)"
msgstr ""
#: ../../whatsnew/3.5.rst:94
msgid "CPython implementation improvements:"
msgstr "CPython 實作改進:"
#: ../../whatsnew/3.5.rst:96
msgid ""
"When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), :py:data:"
"`sys.stdin` and :py:data:`sys.stdout` now use the ``surrogateescape`` error "
"handler, instead of the ``strict`` error handler. (Contributed by Victor "
"Stinner in :issue:`19977`.)"
msgstr ""
#: ../../whatsnew/3.5.rst:101
msgid ""
"``.pyo`` files are no longer used and have been replaced by a more flexible "
"scheme that includes the optimization level explicitly in ``.pyc`` name. "
"(See :ref:`PEP 488 overview <whatsnew-pep-488>`.)"
msgstr ""
#: ../../whatsnew/3.5.rst:105
msgid ""
"Builtin and extension modules are now initialized in a multi-phase process, "
"which is similar to how Python modules are loaded. (See :ref:`PEP 489 "
"overview <whatsnew-pep-489>`.)"
msgstr ""
#: ../../whatsnew/3.5.rst:110
msgid "Significant improvements in the standard library:"
msgstr "標準函式庫中的顯著改進"
#: ../../whatsnew/3.5.rst:112
msgid ""
":class:`collections.OrderedDict` is now :ref:`implemented in C <whatsnew-"
"ordereddict>`, which makes it 4 to 100 times faster."
msgstr ""
#: ../../whatsnew/3.5.rst:116
msgid ""
"The :mod:`ssl` module gained :ref:`support for Memory BIO <whatsnew-"
"sslmemorybio>`, which decouples SSL protocol handling from network IO."
msgstr ""
#: ../../whatsnew/3.5.rst:120
msgid ""
"The new :func:`os.scandir` function provides a :ref:`better and "
"significantly faster way <whatsnew-pep-471>` of directory traversal."
msgstr ""
#: ../../whatsnew/3.5.rst:124
msgid ""
":func:`functools.lru_cache` has been mostly :ref:`reimplemented in C "
"<whatsnew-lrucache>`, yielding much better performance."
msgstr ""
#: ../../whatsnew/3.5.rst:128
msgid ""
"The new :func:`subprocess.run` function provides a :ref:`streamlined way to "
"run subprocesses <whatsnew-subprocess>`."
msgstr ""
#: ../../whatsnew/3.5.rst:131
msgid ""
"The :mod:`traceback` module has been significantly :ref:`enhanced <whatsnew-"
"traceback>` for improved performance and developer convenience."
msgstr ""
#: ../../whatsnew/3.5.rst:136
msgid "Security improvements:"
msgstr "安全性改進:"
#: ../../whatsnew/3.5.rst:138
msgid ""
"SSLv3 is now disabled throughout the standard library. It can still be "
"enabled by instantiating a :class:`ssl.SSLContext` manually. (See :issue:"
"`22638` for more details; this change was backported to CPython 3.4 and 2.7.)"
msgstr ""
#: ../../whatsnew/3.5.rst:143
msgid ""
"HTTP cookie parsing is now stricter, in order to protect against potential "
"injection attacks. (Contributed by Antoine Pitrou in :issue:`22796`.)"
msgstr ""
#: ../../whatsnew/3.5.rst:148
msgid "Windows improvements:"
msgstr ""
#: ../../whatsnew/3.5.rst:150
msgid ""
"A new installer for Windows has replaced the old MSI. See :ref:`using-on-"
"windows` for more information."
msgstr ""
#: ../../whatsnew/3.5.rst:153
msgid ""
"Windows builds now use Microsoft Visual C++ 14.0, and extension modules "
"should use the same."
msgstr ""
#: ../../whatsnew/3.5.rst:157
msgid ""
"Please read on for a comprehensive list of user-facing changes, including "
"many other smaller improvements, CPython optimizations, deprecations, and "
"potential porting issues."
msgstr ""
#: ../../whatsnew/3.5.rst:163
msgid "New Features"
msgstr "新增功能"
#: ../../whatsnew/3.5.rst:168
msgid "PEP 492 - Coroutines with async and await syntax"
msgstr ""
#: ../../whatsnew/3.5.rst:170
msgid ""
":pep:`492` greatly improves support for asynchronous programming in Python "
"by adding :term:`awaitable objects <awaitable>`, :term:`coroutine functions "
"<coroutine function>`, :term:`asynchronous iteration <asynchronous "
"iterable>`, and :term:`asynchronous context managers <asynchronous context "
"manager>`."
msgstr ""
#: ../../whatsnew/3.5.rst:176
msgid ""
"Coroutine functions are declared using the new :keyword:`async def` syntax::"
msgstr ""
#: ../../whatsnew/3.5.rst:178
msgid ""
">>> async def coro():\n"
"... return 'spam'"
msgstr ""
">>> async def coro():\n"
"... return 'spam'"
#: ../../whatsnew/3.5.rst:181
msgid ""
"Inside a coroutine function, the new :keyword:`await` expression can be used "
"to suspend coroutine execution until the result is available. Any object "
"can be *awaited*, as long as it implements the :term:`awaitable` protocol by "
"defining the :meth:`__await__` method."
msgstr ""
#: ../../whatsnew/3.5.rst:186
msgid ""
"PEP 492 also adds :keyword:`async for` statement for convenient iteration "
"over asynchronous iterables."
msgstr ""
#: ../../whatsnew/3.5.rst:189
msgid "An example of a rudimentary HTTP client written using the new syntax::"
msgstr ""
#: ../../whatsnew/3.5.rst:191
msgid ""
"import asyncio\n"
"\n"
"async def http_get(domain):\n"
" reader, writer = await asyncio.open_connection(domain, 80)\n"
"\n"
" writer.write(b'\\r\\n'.join([\n"
" b'GET / HTTP/1.1',\n"
" b'Host: %b' % domain.encode('latin-1'),\n"
" b'Connection: close',\n"
" b'', b''\n"
" ]))\n"
"\n"
" async for line in reader:\n"
" print('>>>', line)\n"
"\n"
" writer.close()\n"
"\n"
"loop = asyncio.get_event_loop()\n"
"try:\n"
" loop.run_until_complete(http_get('example.com'))\n"
"finally:\n"
" loop.close()"
msgstr ""
"import asyncio\n"
"\n"
"async def http_get(domain):\n"
" reader, writer = await asyncio.open_connection(domain, 80)\n"
"\n"
" writer.write(b'\\r\\n'.join([\n"
" b'GET / HTTP/1.1',\n"
" b'Host: %b' % domain.encode('latin-1'),\n"
" b'Connection: close',\n"
" b'', b''\n"
" ]))\n"
"\n"
" async for line in reader:\n"
" print('>>>', line)\n"
"\n"
" writer.close()\n"
"\n"
"loop = asyncio.get_event_loop()\n"
"try:\n"
" loop.run_until_complete(http_get('example.com'))\n"
"finally:\n"
" loop.close()"
#: ../../whatsnew/3.5.rst:215
msgid ""
"Similarly to asynchronous iteration, there is a new syntax for asynchronous "
"context managers. The following script::"
msgstr ""
#: ../../whatsnew/3.5.rst:218
msgid ""
"import asyncio\n"
"\n"
"async def coro(name, lock):\n"
" print('coro {}: waiting for lock'.format(name))\n"
" async with lock:\n"
" print('coro {}: holding the lock'.format(name))\n"
" await asyncio.sleep(1)\n"
" print('coro {}: releasing the lock'.format(name))\n"
"\n"
"loop = asyncio.get_event_loop()\n"
"lock = asyncio.Lock()\n"
"coros = asyncio.gather(coro(1, lock), coro(2, lock))\n"
"try:\n"
" loop.run_until_complete(coros)\n"
"finally:\n"
" loop.close()"
msgstr ""
#: ../../whatsnew/3.5.rst:235
msgid "will output::"
msgstr ""
#: ../../whatsnew/3.5.rst:237
msgid ""
"coro 2: waiting for lock\n"
"coro 2: holding the lock\n"
"coro 1: waiting for lock\n"
"coro 2: releasing the lock\n"
"coro 1: holding the lock\n"
"coro 1: releasing the lock"
msgstr ""
#: ../../whatsnew/3.5.rst:244
msgid ""
"Note that both :keyword:`async for` and :keyword:`async with` can only be "
"used inside a coroutine function declared with :keyword:`async def`."
msgstr ""
#: ../../whatsnew/3.5.rst:247
msgid ""
"Coroutine functions are intended to be run inside a compatible event loop, "
"such as the :ref:`asyncio loop <asyncio-event-loop>`."
msgstr ""
#: ../../whatsnew/3.5.rst:253
msgid ""
"Starting with CPython 3.5.2, ``__aiter__`` can directly return :term:"
"`asynchronous iterators <asynchronous iterator>`. Returning an :term:"
"`awaitable` object will result in a :exc:`PendingDeprecationWarning`."
msgstr ""
#: ../../whatsnew/3.5.rst:259
msgid "See more details in the :ref:`async-iterators` documentation section."
msgstr ""
#: ../../whatsnew/3.5.rst:265
msgid ":pep:`492` -- Coroutines with async and await syntax"
msgstr ""
#: ../../whatsnew/3.5.rst:266
msgid "PEP written and implemented by Yury Selivanov."
msgstr "由 Yury Selivanov 撰寫 PEP 與實作。"
#: ../../whatsnew/3.5.rst:272
msgid "PEP 465 - A dedicated infix operator for matrix multiplication"
msgstr ""
#: ../../whatsnew/3.5.rst:274
msgid ""
":pep:`465` adds the ``@`` infix operator for matrix multiplication. "
"Currently, no builtin Python types implement the new operator, however, it "
"can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`, and :"
"meth:`__imatmul__` for regular, reflected, and in-place matrix "
"multiplication. The semantics of these methods is similar to that of "
"methods defining other infix arithmetic operators."
msgstr ""
#: ../../whatsnew/3.5.rst:281
msgid ""
"Matrix multiplication is a notably common operation in many fields of "
"mathematics, science, engineering, and the addition of ``@`` allows writing "
"cleaner code::"
msgstr ""
#: ../../whatsnew/3.5.rst:285
msgid "S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)"
msgstr "S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)"
#: ../../whatsnew/3.5.rst:287
msgid "instead of::"
msgstr ""
#: ../../whatsnew/3.5.rst:289
msgid ""
"S = dot((dot(H, beta) - r).T,\n"
" dot(inv(dot(dot(H, V), H.T)), dot(H, beta) - r))"
msgstr ""
"S = dot((dot(H, beta) - r).T,\n"
" dot(inv(dot(dot(H, V), H.T)), dot(H, beta) - r))"
#: ../../whatsnew/3.5.rst:292
msgid "NumPy 1.10 has support for the new operator::"
msgstr ""
#: ../../whatsnew/3.5.rst:294
msgid ""
">>> import numpy\n"
"\n"
">>> x = numpy.ones(3)\n"
">>> x\n"
"array([ 1., 1., 1.])\n"
"\n"
">>> m = numpy.eye(3)\n"
">>> m\n"
"array([[ 1., 0., 0.],\n"
" [ 0., 1., 0.],\n"
" [ 0., 0., 1.]])\n"
"\n"
">>> x @ m\n"
"array([ 1., 1., 1.])"
msgstr ""
">>> import numpy\n"
"\n"
">>> x = numpy.ones(3)\n"
">>> x\n"
"array([ 1., 1., 1.])\n"
"\n"
">>> m = numpy.eye(3)\n"
">>> m\n"
"array([[ 1., 0., 0.],\n"
" [ 0., 1., 0.],\n"
" [ 0., 0., 1.]])\n"
"\n"
">>> x @ m\n"
"array([ 1., 1., 1.])"
#: ../../whatsnew/3.5.rst:312
msgid ":pep:`465` -- A dedicated infix operator for matrix multiplication"
msgstr ""
#: ../../whatsnew/3.5.rst:313
msgid "PEP written by Nathaniel J. Smith; implemented by Benjamin Peterson."
msgstr "由 Nathaniel J. Smith 撰寫 PEP;由 Benjamin Peterson 實作。"
#: ../../whatsnew/3.5.rst:319
msgid "PEP 448 - Additional Unpacking Generalizations"
msgstr ""
#: ../../whatsnew/3.5.rst:321
msgid ""
":pep:`448` extends the allowed uses of the ``*`` iterable unpacking operator "
"and ``**`` dictionary unpacking operator. It is now possible to use an "
"arbitrary number of unpackings in :ref:`function calls <calls>`::"
msgstr ""
#: ../../whatsnew/3.5.rst:325
msgid ""
">>> print(*[1], *[2], 3, *[4, 5])\n"
"1 2 3 4 5\n"
"\n"
">>> def fn(a, b, c, d):\n"
"... print(a, b, c, d)\n"
"...\n"
"\n"
">>> fn(**{'a': 1, 'c': 3}, **{'b': 2, 'd': 4})\n"
"1 2 3 4"
msgstr ""
">>> print(*[1], *[2], 3, *[4, 5])\n"
"1 2 3 4 5\n"
"\n"
">>> def fn(a, b, c, d):\n"
"... print(a, b, c, d)\n"
"...\n"
"\n"
">>> fn(**{'a': 1, 'c': 3}, **{'b': 2, 'd': 4})\n"
"1 2 3 4"
#: ../../whatsnew/3.5.rst:335
msgid ""
"Similarly, tuple, list, set, and dictionary displays allow multiple "
"unpackings (see :ref:`exprlists` and :ref:`dict`)::"
msgstr ""
#: ../../whatsnew/3.5.rst:338
msgid ""
">>> *range(4), 4\n"
"(0, 1, 2, 3, 4)\n"
"\n"
">>> [*range(4), 4]\n"
"[0, 1, 2, 3, 4]\n"
"\n"
">>> {*range(4), 4, *(5, 6, 7)}\n"
"{0, 1, 2, 3, 4, 5, 6, 7}\n"
"\n"
">>> {'x': 1, **{'y': 2}}\n"
"{'x': 1, 'y': 2}"
msgstr ""
">>> *range(4), 4\n"
"(0, 1, 2, 3, 4)\n"
"\n"
">>> [*range(4), 4]\n"
"[0, 1, 2, 3, 4]\n"
"\n"
">>> {*range(4), 4, *(5, 6, 7)}\n"
"{0, 1, 2, 3, 4, 5, 6, 7}\n"
"\n"
">>> {'x': 1, **{'y': 2}}\n"
"{'x': 1, 'y': 2}"
#: ../../whatsnew/3.5.rst:352
msgid ":pep:`448` -- Additional Unpacking Generalizations"
msgstr ""
#: ../../whatsnew/3.5.rst:353
msgid ""
"PEP written by Joshua Landau; implemented by Neil Girdhar, Thomas Wouters, "
"and Joshua Landau."
msgstr ""
#: ../../whatsnew/3.5.rst:360
msgid "PEP 461 - percent formatting support for bytes and bytearray"
msgstr ""
#: ../../whatsnew/3.5.rst:362
msgid ""
":pep:`461` adds support for the ``%`` :ref:`interpolation operator <bytes-"
"formatting>` to :class:`bytes` and :class:`bytearray`."
msgstr ""
#: ../../whatsnew/3.5.rst:366
msgid ""
"While interpolation is usually thought of as a string operation, there are "
"cases where interpolation on ``bytes`` or ``bytearrays`` makes sense, and "
"the work needed to make up for this missing functionality detracts from the "
"overall readability of the code. This issue is particularly important when "
"dealing with wire format protocols, which are often a mixture of binary and "
"ASCII compatible text."
msgstr ""
#: ../../whatsnew/3.5.rst:373 ../../whatsnew/3.5.rst:1848
msgid "Examples::"
msgstr "範例: ::"
#: ../../whatsnew/3.5.rst:375
msgid ""
">>> b'Hello %b!' % b'World'\n"
"b'Hello World!'\n"
"\n"
">>> b'x=%i y=%f' % (1, 2.5)\n"
"b'x=1 y=2.500000'"
msgstr ""
">>> b'Hello %b!' % b'World'\n"
"b'Hello World!'\n"
"\n"
">>> b'x=%i y=%f' % (1, 2.5)\n"
"b'x=1 y=2.500000'"
#: ../../whatsnew/3.5.rst:381
msgid ""
"Unicode is not allowed for ``%b``, but it is accepted by ``%a`` (equivalent "
"of ``repr(obj).encode('ascii', 'backslashreplace')``)::"
msgstr ""
#: ../../whatsnew/3.5.rst:384
msgid ""
">>> b'Hello %b!' % 'World'\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 1, in <module>\n"
"TypeError: %b requires bytes, or an object that implements __bytes__, not "
"'str'\n"
"\n"
">>> b'price: %a' % '10€'\n"
"b\"price: '10\\\\u20ac'\""
msgstr ""
">>> b'Hello %b!' % 'World'\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 1, in <module>\n"
"TypeError: %b requires bytes, or an object that implements __bytes__, not "
"'str'\n"
"\n"
">>> b'price: %a' % '10€'\n"
"b\"price: '10\\\\u20ac'\""
#: ../../whatsnew/3.5.rst:392
msgid ""
"Note that ``%s`` and ``%r`` conversion types, although supported, should "
"only be used in codebases that need compatibility with Python 2."
msgstr ""
#: ../../whatsnew/3.5.rst:397
msgid ":pep:`461` -- Adding % formatting to bytes and bytearray"
msgstr ""
#: ../../whatsnew/3.5.rst:398
msgid ""
"PEP written by Ethan Furman; implemented by Neil Schemenauer and Ethan "
"Furman."
msgstr ""
#: ../../whatsnew/3.5.rst:405
msgid "PEP 484 - Type Hints"
msgstr ""
#: ../../whatsnew/3.5.rst:407
msgid ""
"Function annotation syntax has been a Python feature since version 3.0 (:pep:"
"`3107`), however the semantics of annotations has been left undefined."
msgstr ""
#: ../../whatsnew/3.5.rst:410
msgid ""
"Experience has shown that the majority of function annotation uses were to "
"provide type hints to function parameters and return values. It became "
"evident that it would be beneficial for Python users, if the standard "
"library included the base definitions and tools for type annotations."
msgstr ""
#: ../../whatsnew/3.5.rst:415
msgid ""
":pep:`484` introduces a :term:`provisional module <provisional API>` to "
"provide these standard definitions and tools, along with some conventions "
"for situations where annotations are not available."
msgstr ""
#: ../../whatsnew/3.5.rst:419
msgid ""
"For example, here is a simple function whose argument and return type are "
"declared in the annotations::"
msgstr ""
#: ../../whatsnew/3.5.rst:422
msgid ""
"def greeting(name: str) -> str:\n"
" return 'Hello ' + name"
msgstr ""
"def greeting(name: str) -> str:\n"
" return 'Hello ' + name"
#: ../../whatsnew/3.5.rst:425
msgid ""
"While these annotations are available at runtime through the usual :attr:"
"`~object.__annotations__` attribute, *no automatic type checking happens at "
"runtime*. Instead, it is assumed that a separate off-line type checker (e."
"g. `mypy <https://mypy-lang.org>`_) will be used for on-demand source code "
"analysis."
msgstr ""
#: ../../whatsnew/3.5.rst:431
msgid ""
"The type system supports unions, generic types, and a special type named :"
"class:`~typing.Any` which is consistent with (i.e. assignable to and from) "
"all types."
msgstr ""
#: ../../whatsnew/3.5.rst:437
msgid ":mod:`typing` module documentation"
msgstr ":mod:`typing` 模組文件"
#: ../../whatsnew/3.5.rst:438
msgid ":pep:`484` -- Type Hints"
msgstr ""
#: ../../whatsnew/3.5.rst:439
msgid ""
"PEP written by Guido van Rossum, Jukka Lehtosalo, and Łukasz Langa; "
"implemented by Guido van Rossum."
msgstr ""
#: ../../whatsnew/3.5.rst:441
msgid ":pep:`483` -- The Theory of Type Hints"
msgstr ""
#: ../../whatsnew/3.5.rst:442
msgid "PEP written by Guido van Rossum"
msgstr "由 Guido van Rossum 撰寫 PEP"
#: ../../whatsnew/3.5.rst:448
msgid ""
"PEP 471 - os.scandir() function -- a better and faster directory iterator"
msgstr ""
#: ../../whatsnew/3.5.rst:450
msgid ""
":pep:`471` adds a new directory iteration function, :func:`os.scandir`, to "
"the standard library. Additionally, :func:`os.walk` is now implemented "
"using ``scandir``, which makes it 3 to 5 times faster on POSIX systems and 7 "
"to 20 times faster on Windows systems. This is largely achieved by greatly "
"reducing the number of calls to :func:`os.stat` required to walk a directory "
"tree."
msgstr ""
#: ../../whatsnew/3.5.rst:457
msgid ""
"Additionally, ``scandir`` returns an iterator, as opposed to returning a "
"list of file names, which improves memory efficiency when iterating over "
"very large directories."
msgstr ""
#: ../../whatsnew/3.5.rst:461
msgid ""
"The following example shows a simple use of :func:`os.scandir` to display "
"all the files (excluding directories) in the given *path* that don't start "
"with ``'.'``. The :meth:`entry.is_file() <os.DirEntry.is_file>` call will "
"generally not make an additional system call::"
msgstr ""
#: ../../whatsnew/3.5.rst:466
msgid ""
"for entry in os.scandir(path):\n"
" if not entry.name.startswith('.') and entry.is_file():\n"
" print(entry.name)"
msgstr ""
"for entry in os.scandir(path):\n"
" if not entry.name.startswith('.') and entry.is_file():\n"
" print(entry.name)"
#: ../../whatsnew/3.5.rst:472
msgid ""
":pep:`471` -- os.scandir() function -- a better and faster directory iterator"
msgstr ""
#: ../../whatsnew/3.5.rst:473
msgid ""
"PEP written and implemented by Ben Hoyt with the help of Victor Stinner."
msgstr "在 Victor Stinner 協助下由 Ben Hoyt 撰寫 PEP 與實作。"
#: ../../whatsnew/3.5.rst:479
msgid "PEP 475: Retry system calls failing with EINTR"
msgstr ""
#: ../../whatsnew/3.5.rst:481
msgid ""
"An :py:const:`errno.EINTR` error code is returned whenever a system call, "
"that is waiting for I/O, is interrupted by a signal. Previously, Python "
"would raise :exc:`InterruptedError` in such cases. This meant that, when "
"writing a Python application, the developer had two choices:"
msgstr ""
#: ../../whatsnew/3.5.rst:486
msgid "Ignore the ``InterruptedError``."
msgstr ""
#: ../../whatsnew/3.5.rst:487
msgid ""
"Handle the ``InterruptedError`` and attempt to restart the interrupted "
"system call at every call site."
msgstr ""
#: ../../whatsnew/3.5.rst:490
msgid ""
"The first option makes an application fail intermittently. The second option "
"adds a large amount of boilerplate that makes the code nearly unreadable. "
"Compare::"
msgstr ""
#: ../../whatsnew/3.5.rst:494
msgid "print(\"Hello World\")"
msgstr "print(\"Hello World\")"
#: ../../whatsnew/3.5.rst:496
msgid "and::"
msgstr "和: ::"
#: ../../whatsnew/3.5.rst:498
msgid ""
"while True:\n"
" try:\n"
" print(\"Hello World\")\n"
" break\n"
" except InterruptedError:\n"
" continue"
msgstr ""
"while True:\n"
" try:\n"
" print(\"Hello World\")\n"
" break\n"
" except InterruptedError:\n"
" continue"
#: ../../whatsnew/3.5.rst:505
msgid ""
":pep:`475` implements automatic retry of system calls on ``EINTR``. This "
"removes the burden of dealing with ``EINTR`` or :exc:`InterruptedError` in "
"user code in most situations and makes Python programs, including the "
"standard library, more robust. Note that the system call is only retried if "
"the signal handler does not raise an exception."
msgstr ""
#: ../../whatsnew/3.5.rst:512
msgid ""
"Below is a list of functions which are now retried when interrupted by a "
"signal:"
msgstr ""
#: ../../whatsnew/3.5.rst:515
msgid ":func:`open` and :func:`io.open`;"
msgstr ":func:`open` 和 :func:`io.open`\\ ;"
#: ../../whatsnew/3.5.rst:517
msgid "functions of the :mod:`faulthandler` module;"
msgstr ":mod:`faulthandler` 模組的函式;"
#: ../../whatsnew/3.5.rst:519
msgid ""
":mod:`os` functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os."
"fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :"
"func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os."
"mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os."
"posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :"
"func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os."
"wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:"
"`~os.write`, :func:`~os.writev`;"
msgstr ""
#: ../../whatsnew/3.5.rst:529
msgid ""
"special cases: :func:`os.close` and :func:`os.dup2` now ignore :py:const:"
"`~errno.EINTR` errors; the syscall is not retried (see the PEP for the "
"rationale);"
msgstr ""
#: ../../whatsnew/3.5.rst:533
msgid ""
":mod:`select` functions: :func:`devpoll.poll() <select.devpoll.poll>`, :func:"
"`epoll.poll() <select.epoll.poll>`, :func:`kqueue.control() <select.kqueue."
"control>`, :func:`poll.poll() <select.poll.poll>`, :func:`~select.select`;"
msgstr ""
#: ../../whatsnew/3.5.rst:538
msgid ""
"methods of the :class:`~socket.socket` class: :meth:`~socket.socket."
"accept`, :meth:`~socket.socket.connect` (except for non-blocking sockets), :"
"meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket."
"socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket."
"sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;"
msgstr ""
#: ../../whatsnew/3.5.rst:545
msgid ":func:`signal.sigtimedwait` and :func:`signal.sigwaitinfo`;"
msgstr ":func:`signal.sigtimedwait` 和 :func:`signal.sigwaitinfo`\\ ;"
#: ../../whatsnew/3.5.rst:547
msgid ":func:`time.sleep`."
msgstr ":func:`time.sleep`。"
#: ../../whatsnew/3.5.rst:551
msgid ":pep:`475` -- Retry system calls failing with EINTR"
msgstr ""
#: ../../whatsnew/3.5.rst:552
msgid ""
"PEP and implementation written by Charles-François Natali and Victor "
"Stinner, with the help of Antoine Pitrou (the French connection)."
msgstr ""
#: ../../whatsnew/3.5.rst:559
msgid "PEP 479: Change StopIteration handling inside generators"
msgstr ""
#: ../../whatsnew/3.5.rst:561
msgid ""
"The interaction of generators and :exc:`StopIteration` in Python 3.4 and "
"earlier was sometimes surprising, and could conceal obscure bugs. "
"Previously, ``StopIteration`` raised accidentally inside a generator "
"function was interpreted as the end of the iteration by the loop construct "
"driving the generator."
msgstr ""
#: ../../whatsnew/3.5.rst:567
msgid ""
":pep:`479` changes the behavior of generators: when a ``StopIteration`` "
"exception is raised inside a generator, it is replaced with a :exc:"
"`RuntimeError` before it exits the generator frame. The main goal of this "
"change is to ease debugging in the situation where an unguarded :func:`next` "
"call raises ``StopIteration`` and causes the iteration controlled by the "
"generator to terminate silently. This is particularly pernicious in "
"combination with the ``yield from`` construct."
msgstr ""
#: ../../whatsnew/3.5.rst:575
msgid ""
"This is a backwards incompatible change, so to enable the new behavior, a :"
"term:`__future__` import is necessary::"
msgstr ""
#: ../../whatsnew/3.5.rst:578
msgid ""
">>> from __future__ import generator_stop\n"
"\n"
">>> def gen():\n"
"... next(iter([]))\n"
"... yield\n"
"...\n"
">>> next(gen())\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 2, in gen\n"
"StopIteration\n"
"\n"
"The above exception was the direct cause of the following exception:\n"
"\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 1, in <module>\n"
"RuntimeError: generator raised StopIteration"
msgstr ""
">>> from __future__ import generator_stop\n"
"\n"
">>> def gen():\n"
"... next(iter([]))\n"
"... yield\n"
"...\n"
">>> next(gen())\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 2, in gen\n"
"StopIteration\n"
"\n"
"The above exception was the direct cause of the following exception:\n"
"\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 1, in <module>\n"
"RuntimeError: generator raised StopIteration"
#: ../../whatsnew/3.5.rst:595
msgid ""
"Without a ``__future__`` import, a :exc:`PendingDeprecationWarning` will be "
"raised whenever a :exc:`StopIteration` exception is raised inside a "
"generator."
msgstr ""
#: ../../whatsnew/3.5.rst:600
msgid ":pep:`479` -- Change StopIteration handling inside generators"
msgstr ""
#: ../../whatsnew/3.5.rst:601
msgid ""
"PEP written by Chris Angelico and Guido van Rossum. Implemented by Chris "
"Angelico, Yury Selivanov and Nick Coghlan."
msgstr ""
#: ../../whatsnew/3.5.rst:608
msgid "PEP 485: A function for testing approximate equality"
msgstr ""
#: ../../whatsnew/3.5.rst:610
msgid ""
":pep:`485` adds the :func:`math.isclose` and :func:`cmath.isclose` functions "
"which tell whether two values are approximately equal or \"close\" to each "
"other. Whether or not two values are considered close is determined "
"according to given absolute and relative tolerances. Relative tolerance is "
"the maximum allowed difference between ``isclose`` arguments, relative to "
"the larger absolute value::"
msgstr ""
#: ../../whatsnew/3.5.rst:617
msgid ""
">>> import math\n"
">>> a = 5.0\n"
">>> b = 4.99998\n"
">>> math.isclose(a, b, rel_tol=1e-5)\n"
"True\n"
">>> math.isclose(a, b, rel_tol=1e-6)\n"
"False"
msgstr ""
">>> import math\n"
">>> a = 5.0\n"
">>> b = 4.99998\n"
">>> math.isclose(a, b, rel_tol=1e-5)\n"
"True\n"
">>> math.isclose(a, b, rel_tol=1e-6)\n"
"False"