-
-
Notifications
You must be signed in to change notification settings - Fork 214
/
Copy pathstdtypes.po
8982 lines (7650 loc) · 292 KB
/
stdtypes.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-2024, Python Software Foundation
# This file is distributed under the same license as the Python package.
#
# Translators:
# Leon H., 2017
# Adrian Liaw <adrianliaw2000@gmail.com>, 2018
# Matt Wang <mattwang44@gmail.com>, 2021
msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-30 00:13+0000\n"
"PO-Revision-Date: 2022-06-12 15:22+0800\n"
"Last-Translator: Matt Wang <mattwang44@gmail.com>\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"
"X-Generator: Poedit 3.1\n"
#: ../../library/stdtypes.rst:8
msgid "Built-in Types"
msgstr "內建型別"
#: ../../library/stdtypes.rst:10
msgid ""
"The following sections describe the standard types that are built into the "
"interpreter."
msgstr "以下章節描述了直譯器中内建的標準型別。"
#: ../../library/stdtypes.rst:15
msgid ""
"The principal built-in types are numerics, sequences, mappings, classes, "
"instances and exceptions."
msgstr "主要內建型別為數字、序列、對映、class(類別)、實例和例外。"
#: ../../library/stdtypes.rst:18
msgid ""
"Some collection classes are mutable. The methods that add, subtract, or "
"rearrange their members in place, and don't return a specific item, never "
"return the collection instance itself but ``None``."
msgstr ""
"有些集合類別是 mutable(可變的)。那些用於原地 (in-place) 加入、移除或重新排"
"列其成員且不回傳特定項的 method(方法),也只會回傳 ``None`` 而非集合實例自"
"己。"
#: ../../library/stdtypes.rst:22
msgid ""
"Some operations are supported by several object types; in particular, "
"practically all objects can be compared for equality, tested for truth "
"value, and converted to a string (with the :func:`repr` function or the "
"slightly different :func:`str` function). The latter function is implicitly "
"used when an object is written by the :func:`print` function."
msgstr ""
"某些操作已被多種物件型別支援;特別是實務上所有物件都已經可以做相等性比較、真"
"值檢測及被轉換為字串(使用 :func:`repr` 函式或稍有差異的 :func:`str` 函式),"
"後者為當物件傳入 :func:`print` 函式印出時在背後被呼叫的函式。"
#: ../../library/stdtypes.rst:32
msgid "Truth Value Testing"
msgstr "真值檢測"
#: ../../library/stdtypes.rst:41
msgid ""
"Any object can be tested for truth value, for use in an :keyword:`if` or :"
"keyword:`while` condition or as operand of the Boolean operations below."
msgstr ""
"任何物件都可以進行檢測以判斷是否為真值,以便在 :keyword:`if` 或 :keyword:"
"`while` 條件中使用,或是作為如下所述 boolean(布林)運算之運算元所用。"
#: ../../library/stdtypes.rst:46
msgid ""
"By default, an object is considered true unless its class defines either a :"
"meth:`~object.__bool__` method that returns ``False`` or a :meth:`~object."
"__len__` method that returns zero, when called with the object. [1]_ Here "
"are most of the built-in objects considered false:"
msgstr ""
"預設情況下,一個物件會被視為真值,除非它的 class 定義了會回傳 ``False`` 的 :"
"meth:`~object.__bool__` method 或是定義了會回傳零的 :meth:`~object.__len__` "
"method。[1]_ 以下列出了大部分會被視為 false 的內建物件:"
#: ../../library/stdtypes.rst:56
msgid "constants defined to be false: ``None`` and ``False``"
msgstr "定義為 false 之常數:``None`` 與 ``False``"
#: ../../library/stdtypes.rst:58
msgid ""
"zero of any numeric type: ``0``, ``0.0``, ``0j``, ``Decimal(0)``, "
"``Fraction(0, 1)``"
msgstr ""
"任何數值型別的零:``0``、``0.0``、``0j``、``Decimal(0)``、``Fraction(0, 1)``"
#: ../../library/stdtypes.rst:61
msgid ""
"empty sequences and collections: ``''``, ``()``, ``[]``, ``{}``, ``set()``, "
"``range(0)``"
msgstr ""
"空的序列和集合:``''``、``()``、``[]``、``{}``、``set()``、``range(0)``"
#: ../../library/stdtypes.rst:70
msgid ""
"Operations and built-in functions that have a Boolean result always return "
"``0`` or ``False`` for false and ``1`` or ``True`` for true, unless "
"otherwise stated. (Important exception: the Boolean operations ``or`` and "
"``and`` always return one of their operands.)"
msgstr ""
"除非另有特別說明,產生 boolean 結果的操作或內建函式都會回傳 ``0`` 或 "
"``False`` 作為假值、``1`` 或 ``True`` 作為真值。(重要例外: boolean 運算 "
"``or`` 和 ``and`` 回傳的是其中一個運算元。)"
#: ../../library/stdtypes.rst:79
msgid "Boolean Operations --- :keyword:`!and`, :keyword:`!or`, :keyword:`!not`"
msgstr ""
"Boolean(布林)運算 --- :keyword:`!and`, :keyword:`!or`, :keyword:`!not`"
#: ../../library/stdtypes.rst:83
msgid "These are the Boolean operations, ordered by ascending priority:"
msgstr "下方為 Boolean 運算,按優先順序排序:"
#: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:144
#: ../../library/stdtypes.rst:276 ../../library/stdtypes.rst:366
#: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965
#: ../../library/stdtypes.rst:1170
msgid "Operation"
msgstr "運算"
#: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276
#: ../../library/stdtypes.rst:366 ../../library/stdtypes.rst:416
#: ../../library/stdtypes.rst:965 ../../library/stdtypes.rst:1170
msgid "Result"
msgstr "結果"
#: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276
#: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965
#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2432
#: ../../library/stdtypes.rst:3651
msgid "Notes"
msgstr "註解"
#: ../../library/stdtypes.rst:88
msgid "``x or y``"
msgstr "``x or y``"
#: ../../library/stdtypes.rst:88
msgid "if *x* is true, then *x*, else *y*"
msgstr "假如 *x* 為真,則 *x*,否則 *y*"
#: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967
#: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1181
#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657
msgid "\\(1)"
msgstr "\\(1)"
#: ../../library/stdtypes.rst:91
msgid "``x and y``"
msgstr "``x and y``"
#: ../../library/stdtypes.rst:91
msgid "if *x* is false, then *x*, else *y*"
msgstr "假如 *x* 為假,則 *x*,否則 *y*"
#: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289
#: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1209
#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:2444
#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3663
msgid "\\(2)"
msgstr "\\(2)"
#: ../../library/stdtypes.rst:94
msgid "``not x``"
msgstr "``not x``"
#: ../../library/stdtypes.rst:94
msgid "if *x* is false, then ``True``, else ``False``"
msgstr "假如 *x* 為假,則 ``True``,否則 ``False``"
#: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:979
#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2446
#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:2450
#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3665
#: ../../library/stdtypes.rst:3667 ../../library/stdtypes.rst:3669
#: ../../library/stdtypes.rst:3671
msgid "\\(3)"
msgstr "\\(3)"
#: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320
#: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016
#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2478
#: ../../library/stdtypes.rst:3701
msgid "Notes:"
msgstr "註解:"
#: ../../library/stdtypes.rst:106
msgid ""
"This is a short-circuit operator, so it only evaluates the second argument "
"if the first one is false."
msgstr ""
"這是一個短路運算子,所以他只有在第一個引數為假時,才會對第二個引數求值。"
#: ../../library/stdtypes.rst:110
msgid ""
"This is a short-circuit operator, so it only evaluates the second argument "
"if the first one is true."
msgstr ""
"這是一個短路運算子,所以他只有在第一個引數為真時,才會對第二個引數求值。"
#: ../../library/stdtypes.rst:114
msgid ""
"``not`` has a lower priority than non-Boolean operators, so ``not a == b`` "
"is interpreted as ``not (a == b)``, and ``a == not b`` is a syntax error."
msgstr ""
"``not`` 比非 Boolean 運算子有較低的優先權,因此 ``not a == b`` 可直譯為 "
"``not (a == b)``,而 ``a == not b`` 會導致語法錯誤。"
#: ../../library/stdtypes.rst:121
msgid "Comparisons"
msgstr "比較運算"
#: ../../library/stdtypes.rst:135
msgid ""
"There are eight comparison operations in Python. They all have the same "
"priority (which is higher than that of the Boolean operations). Comparisons "
"can be chained arbitrarily; for example, ``x < y <= z`` is equivalent to ``x "
"< y and y <= z``, except that *y* is evaluated only once (but in both cases "
"*z* is not evaluated at all when ``x < y`` is found to be false)."
msgstr ""
"在 Python 裡共有 8 種比較運算。他們的優先順序都相同(皆優先於 Boolean 運"
"算)。比較運算可以任意的串連;例如,``x < y <= z`` 等同於 ``x < y and y <= "
"z``,差異只在於前者的 *y* 只有被求值一次(但在這兩個例子中,當 ``x < y`` 為假"
"時,*z* 皆不會被求值)。"
#: ../../library/stdtypes.rst:141
msgid "This table summarizes the comparison operations:"
msgstr "這個表格統整所有比較運算:"
#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2409
#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3628
#: ../../library/stdtypes.rst:3651
msgid "Meaning"
msgstr "含義"
#: ../../library/stdtypes.rst:146
msgid "``<``"
msgstr "``<``"
#: ../../library/stdtypes.rst:146
msgid "strictly less than"
msgstr "小於"
#: ../../library/stdtypes.rst:148
msgid "``<=``"
msgstr "``<=``"
#: ../../library/stdtypes.rst:148
msgid "less than or equal"
msgstr "小於等於"
#: ../../library/stdtypes.rst:150
msgid "``>``"
msgstr "``>``"
#: ../../library/stdtypes.rst:150
msgid "strictly greater than"
msgstr "大於"
#: ../../library/stdtypes.rst:152
msgid "``>=``"
msgstr "``>=``"
#: ../../library/stdtypes.rst:152
msgid "greater than or equal"
msgstr "大於等於"
#: ../../library/stdtypes.rst:154
msgid "``==``"
msgstr "``==``"
#: ../../library/stdtypes.rst:154
msgid "equal"
msgstr "等於"
#: ../../library/stdtypes.rst:156
msgid "``!=``"
msgstr "``!=``"
#: ../../library/stdtypes.rst:156
msgid "not equal"
msgstr "不等於"
#: ../../library/stdtypes.rst:158
msgid "``is``"
msgstr "``is``"
#: ../../library/stdtypes.rst:158
msgid "object identity"
msgstr "物件識別性"
#: ../../library/stdtypes.rst:160
msgid "``is not``"
msgstr "``is not``"
#: ../../library/stdtypes.rst:160
msgid "negated object identity"
msgstr "否定的物件識別性"
#: ../../library/stdtypes.rst:167
msgid ""
"Objects of different types, except different numeric types, never compare "
"equal. The ``==`` operator is always defined but for some object types (for "
"example, class objects) is equivalent to :keyword:`is`. The ``<``, ``<=``, "
"``>`` and ``>=`` operators are only defined where they make sense; for "
"example, they raise a :exc:`TypeError` exception when one of the arguments "
"is a complex number."
msgstr ""
"除了不同的數值型別外,不同型別的物件不能進行相等比較。運算子 ``==`` 總有定"
"義,但在某些物件型別(例如,class 物件)時,運算子會等同於 :keyword:`is`。其"
"他運算子 ``<``、``<=``、``>`` 及 ``>=`` 皆僅在有意義的部分有所定義;例如,當"
"其中一個引數為複數時,將引發一個 :exc:`TypeError` 的例外。"
#: ../../library/stdtypes.rst:181
msgid ""
"Non-identical instances of a class normally compare as non-equal unless the "
"class defines the :meth:`~object.__eq__` method."
msgstr ""
"一個 class 的非相同實例通常會比較為不相等,除非 class 有定義 :meth:`~object."
"__eq__` method。"
#: ../../library/stdtypes.rst:184
msgid ""
"Instances of a class cannot be ordered with respect to other instances of "
"the same class, or other types of object, unless the class defines enough of "
"the methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object."
"__gt__`, and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` and :"
"meth:`~object.__eq__` are sufficient, if you want the conventional meanings "
"of the comparison operators)."
msgstr ""
"一個 class 的實例不可以與其他相同 class 的實例或其他物件型別進行排序,除非 "
"class 定義足夠的 method ,包含 :meth:`~object.__lt__`、:meth:`~object."
"__le__`、:meth:`~object.__gt__` 及 :meth:`~object.__ge__`\\ (一般來說,使"
"用 :meth:`~object.__lt__` 及 :meth:`~object.__eq__` 就可以滿足常規意義上的比"
"較運算子)。"
#: ../../library/stdtypes.rst:191
msgid ""
"The behavior of the :keyword:`is` and :keyword:`is not` operators cannot be "
"customized; also they can be applied to any two objects and never raise an "
"exception."
msgstr ""
"無法自定義 :keyword:`is` 與 :keyword:`is not` 運算子的行為;這兩個運算子也可"
"以運用在任意兩個物件且不會引發例外。"
#: ../../library/stdtypes.rst:199
msgid ""
"Two more operations with the same syntactic priority, :keyword:`in` and :"
"keyword:`not in`, are supported by types that are :term:`iterable` or "
"implement the :meth:`~object.__contains__` method."
msgstr ""
"此外,擁有相同的語法優先序的 :keyword:`in` 及 :keyword:`not in` 兩種運算皆被"
"\\ :term:`可疊代物件 <iterable>`\\ 或者有實作 :meth:`~object.__contains__` "
"method 的型別所支援。"
#: ../../library/stdtypes.rst:206
msgid "Numeric Types --- :class:`int`, :class:`float`, :class:`complex`"
msgstr "數值型別 --- :class:`int`、:class:`float`、:class:`complex`"
#: ../../library/stdtypes.rst:216
msgid ""
"There are three distinct numeric types: :dfn:`integers`, :dfn:`floating-"
"point numbers`, and :dfn:`complex numbers`. In addition, Booleans are a "
"subtype of integers. Integers have unlimited precision. Floating-point "
"numbers are usually implemented using :c:expr:`double` in C; information "
"about the precision and internal representation of floating-point numbers "
"for the machine on which your program is running is available in :data:`sys."
"float_info`. Complex numbers have a real and imaginary part, which are each "
"a floating-point number. To extract these parts from a complex number *z*, "
"use ``z.real`` and ``z.imag``. (The standard library includes the additional "
"numeric types :mod:`fractions.Fraction`, for rationals, and :mod:`decimal."
"Decimal`, for floating-point numbers with user-definable precision.)"
msgstr ""
"數值型別共有三種::dfn:`整數`、:dfn:`浮點數` 及 :dfn:`複數`。此外,Boolean 為"
"整數中的一個子型別。整數有無限的精度。浮點數通常使用 C 裡面的 :c:expr:"
"`double` 實作。關於在你程式所運作的機器上之浮點數的精度及內部表示法可以在 :"
"data:`sys.float_info` 進行查找。複數包含實數及虛數的部分,這兩部分各自是一個"
"浮點數。若要從一個複數 *z* 提取這兩部分,需使用 ``z.real`` 及 ``z.imag``。"
"(標準函式庫包含額外的數值型別,像是 :mod:`fractions.Fraction` 表示有理數,"
"而 :mod:`decimal.Decimal` 表示可由使用者制定精度的浮點數。)"
#: ../../library/stdtypes.rst:238
msgid ""
"Numbers are created by numeric literals or as the result of built-in "
"functions and operators. Unadorned integer literals (including hex, octal "
"and binary numbers) yield integers. Numeric literals containing a decimal "
"point or an exponent sign yield floating-point numbers. Appending ``'j'`` "
"or ``'J'`` to a numeric literal yields an imaginary number (a complex number "
"with a zero real part) which you can add to an integer or float to get a "
"complex number with real and imaginary parts."
msgstr ""
"數字是由字面數值或內建公式及運算子的結果所產生的。未經修飾的字面數值(含十六"
"進位、八進位及二進位數值)會 yield 整數。包含小數點或指數符號的字面數值會 "
"yield 浮點數。在數值後面加上 ``'j'`` 或是 ``'J'`` 會 yield 一個虛數(意即一個"
"實數為 0 的複數)。你也可以將整數與浮點數相加以得到一個有實部與虛部的複數。"
#: ../../library/stdtypes.rst:263
msgid ""
"Python fully supports mixed arithmetic: when a binary arithmetic operator "
"has operands of different numeric types, the operand with the \"narrower\" "
"type is widened to that of the other, where integer is narrower than "
"floating point, which is narrower than complex. A comparison between numbers "
"of different types behaves as though the exact values of those numbers were "
"being compared. [2]_"
msgstr ""
"Python 完全支援混和運算:當一個二元運算子的運算元有不同數值型別時,「較窄」型"
"別的運算元會被拓寬到另一個型別的運算元;在此處,整數窄於浮點數,浮點數又窄於"
"複數。不同型別的數字間的比較等同於這些數字的精確值進行比較。[2]_"
#: ../../library/stdtypes.rst:269
msgid ""
"The constructors :func:`int`, :func:`float`, and :func:`complex` can be used "
"to produce numbers of a specific type."
msgstr ""
"建構函式: :func:`int`、:func:`float` 及 :func:`complex` 可以用來產生特定型別"
"的數字。"
#: ../../library/stdtypes.rst:272
msgid ""
"All numeric types (except complex) support the following operations (for "
"priorities of the operations, see :ref:`operator-summary`):"
msgstr ""
"所有數值型別(除複數外)皆支援以下的運算(有關運算的先後順序,詳見 :ref:"
"`operator-summary`):"
#: ../../library/stdtypes.rst:276
msgid "Full documentation"
msgstr "完整文件"
#: ../../library/stdtypes.rst:278
msgid "``x + y``"
msgstr "``x + y``"
#: ../../library/stdtypes.rst:278
msgid "sum of *x* and *y*"
msgstr "*x* 及 *y* 的加總"
#: ../../library/stdtypes.rst:280
msgid "``x - y``"
msgstr "``x - y``"
#: ../../library/stdtypes.rst:280
msgid "difference of *x* and *y*"
msgstr "*x* 及 *y* 的相減"
#: ../../library/stdtypes.rst:282
msgid "``x * y``"
msgstr "``x * y``"
#: ../../library/stdtypes.rst:282
msgid "product of *x* and *y*"
msgstr "*x* 及 *y* 的相乘"
#: ../../library/stdtypes.rst:284
msgid "``x / y``"
msgstr "``x / y``"
#: ../../library/stdtypes.rst:284
msgid "quotient of *x* and *y*"
msgstr "*x* 及 *y* 相除之商"
#: ../../library/stdtypes.rst:286
msgid "``x // y``"
msgstr "``x // y``"
#: ../../library/stdtypes.rst:286
msgid "floored quotient of *x* and *y*"
msgstr "*x* 及 *y* 的整數除法"
#: ../../library/stdtypes.rst:286
msgid "\\(1)\\(2)"
msgstr "\\(1)\\(2)"
#: ../../library/stdtypes.rst:289
msgid "``x % y``"
msgstr "``x % y``"
#: ../../library/stdtypes.rst:289
msgid "remainder of ``x / y``"
msgstr "``x / y`` 的餘數"
#: ../../library/stdtypes.rst:291
msgid "``-x``"
msgstr "``-x``"
#: ../../library/stdtypes.rst:291
msgid "*x* negated"
msgstr "*x* 的負數"
#: ../../library/stdtypes.rst:293
msgid "``+x``"
msgstr "``+x``"
#: ../../library/stdtypes.rst:293
msgid "*x* unchanged"
msgstr "*x* 不變"
#: ../../library/stdtypes.rst:295
msgid "``abs(x)``"
msgstr "``abs(x)``"
#: ../../library/stdtypes.rst:295
msgid "absolute value or magnitude of *x*"
msgstr "*x* 的絕對值或量 (magnitude)"
#: ../../library/stdtypes.rst:295
msgid ":func:`abs`"
msgstr ":func:`abs`"
#: ../../library/stdtypes.rst:298
msgid "``int(x)``"
msgstr "``int(x)``"
#: ../../library/stdtypes.rst:298
msgid "*x* converted to integer"
msgstr "將 *x* 轉為整數"
#: ../../library/stdtypes.rst:298
msgid "\\(3)\\(6)"
msgstr "\\(3)\\(6)"
#: ../../library/stdtypes.rst:298
msgid ":func:`int`"
msgstr ":func:`int`"
#: ../../library/stdtypes.rst:300
msgid "``float(x)``"
msgstr "``float(x)``"
#: ../../library/stdtypes.rst:300
msgid "*x* converted to floating point"
msgstr "將 *x* 轉為浮點數"
#: ../../library/stdtypes.rst:300
msgid "\\(4)\\(6)"
msgstr "\\(4)\\(6)"
#: ../../library/stdtypes.rst:300
msgid ":func:`float`"
msgstr ":func:`float`"
#: ../../library/stdtypes.rst:302
msgid "``complex(re, im)``"
msgstr "``complex(re, im)``"
#: ../../library/stdtypes.rst:302
msgid ""
"a complex number with real part *re*, imaginary part *im*. *im* defaults to "
"zero."
msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。"
#: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1202
#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3688
msgid "\\(6)"
msgstr "\\(6)"
#: ../../library/stdtypes.rst:302
msgid ":func:`complex`"
msgstr ":func:`complex`"
#: ../../library/stdtypes.rst:306
msgid "``c.conjugate()``"
msgstr "``c.conjugate()``"
#: ../../library/stdtypes.rst:306
msgid "conjugate of the complex number *c*"
msgstr "為複數 *c* 的共軛複數"
#: ../../library/stdtypes.rst:309
msgid "``divmod(x, y)``"
msgstr "``divmod(x, y)``"
#: ../../library/stdtypes.rst:309
msgid "the pair ``(x // y, x % y)``"
msgstr "一對 ``(x // y, x % y)``"
#: ../../library/stdtypes.rst:309
msgid ":func:`divmod`"
msgstr ":func:`divmod`"
#: ../../library/stdtypes.rst:311
msgid "``pow(x, y)``"
msgstr "``pow(x, y)``"
#: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313
msgid "*x* to the power *y*"
msgstr "*x* 的 *y* 次方"
#: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313
#: ../../library/stdtypes.rst:1191 ../../library/stdtypes.rst:1194
#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:2468
#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3684
#: ../../library/stdtypes.rst:3691
msgid "\\(5)"
msgstr "\\(5)"
#: ../../library/stdtypes.rst:311
msgid ":func:`pow`"
msgstr ":func:`pow`"
#: ../../library/stdtypes.rst:313
msgid "``x ** y``"
msgstr "``x ** y``"
#: ../../library/stdtypes.rst:323
msgid ""
"Also referred to as integer division. For operands of type :class:`int`, "
"the result has type :class:`int`. For operands of type :class:`float`, the "
"result has type :class:`float`. In general, the result is a whole integer, "
"though the result's type is not necessarily :class:`int`. The result is "
"always rounded towards minus infinity: ``1//2`` is ``0``, ``(-1)//2`` is "
"``-1``, ``1//(-2)`` is ``-1``, and ``(-1)//(-2)`` is ``0``."
msgstr ""
"也被稱為整數除法。對於型別為 :class:`int` 的運算元來說,結果之型別會是 :"
"class:`int`。對於型別為 :class:`float` 的運算元來說,結果之型別會是 :class:"
"`float`。一般來說,結果會是一個整數,但其型別不一定會是 :class:`int`。結果總"
"是會往負無窮大的方向取整數值: ``1//2`` 為 ``0``、``(-1)//2`` 為 ``-1``、"
"``1//(-2)`` 為 ``-1`` 及 ``(-1)//(-2)`` 為 ``0``。"
#: ../../library/stdtypes.rst:331
msgid ""
"Not for complex numbers. Instead convert to floats using :func:`abs` if "
"appropriate."
msgstr "不可用於複數。在適當情形下,可使用 :func:`abs` 轉換為浮點數。"
#: ../../library/stdtypes.rst:342
msgid ""
"Conversion from :class:`float` to :class:`int` truncates, discarding the "
"fractional part. See functions :func:`math.floor` and :func:`math.ceil` for "
"alternative conversions."
msgstr ""
"從 :class:`float` 轉換為 :class:`int` 會導致截斷並排除小數部分。詳見 :func:"
"`math.floor` 及 :func:`math.ceil` 以了解更多轉換方式。"
#: ../../library/stdtypes.rst:347
msgid ""
"float also accepts the strings \"nan\" and \"inf\" with an optional prefix "
"\"+\" or \"-\" for Not a Number (NaN) and positive or negative infinity."
msgstr ""
"浮點數也接受帶有可選的前綴 \"+\" 及 \"-\" 的 \"nan\" 及 \"inf\" 字串,其分別"
"代表非數字(NaN)及正負無窮。"
#: ../../library/stdtypes.rst:351
msgid ""
"Python defines ``pow(0, 0)`` and ``0 ** 0`` to be ``1``, as is common for "
"programming languages."
msgstr ""
"Python 將 ``pow(0, 0)`` 及 ``0 ** 0`` 定義為 ``1`` 這是程式語言的普遍做法。"
#: ../../library/stdtypes.rst:355
msgid ""
"The numeric literals accepted include the digits ``0`` to ``9`` or any "
"Unicode equivalent (code points with the ``Nd`` property)."
msgstr ""
"字面數值接受包含數字 ``0`` 到 ``9`` 或任何等效的 Unicode 字元(具有 ``Nd`` 屬"
"性的 code points(碼位))。"
#: ../../library/stdtypes.rst:358
msgid ""
"See `the Unicode Standard <https://unicode.org/Public/UNIDATA/extracted/"
"DerivedNumericType.txt>`_ for a complete list of code points with the ``Nd`` "
"property."
msgstr ""
"請參閱 `Unicode 標準 <https://unicode.org/Public/UNIDATA/extracted/"
"DerivedNumericType.txt>`_\\ 以了解具有 ``Nd`` 屬性的 code points 完整列表。"
#: ../../library/stdtypes.rst:362
msgid ""
"All :class:`numbers.Real` types (:class:`int` and :class:`float`) also "
"include the following operations:"
msgstr ""
"所有 :class:`numbers.Real` 型別(:class:`int` 及 :class:`float`)也適用下列運"
"算:"
#: ../../library/stdtypes.rst:368
msgid ":func:`math.trunc(\\ x) <math.trunc>`"
msgstr ":func:`math.trunc(\\ x) <math.trunc>`"
#: ../../library/stdtypes.rst:368
msgid "*x* truncated to :class:`~numbers.Integral`"
msgstr "*x* 截斷為 :class:`~numbers.Integral`"
#: ../../library/stdtypes.rst:371
msgid ":func:`round(x[, n]) <round>`"
msgstr ":func:`round(x[, n]) <round>`"
#: ../../library/stdtypes.rst:371
msgid ""
"*x* rounded to *n* digits, rounding half to even. If *n* is omitted, it "
"defaults to 0."
msgstr "*x* 進位至小數點後第 *n* 位,使用偶數捨入法。若省略 *n* ,則預設為 0。"
#: ../../library/stdtypes.rst:375
msgid ":func:`math.floor(\\ x) <math.floor>`"
msgstr ":func:`math.floor(\\ x) <math.floor>`"
#: ../../library/stdtypes.rst:375
msgid "the greatest :class:`~numbers.Integral` <= *x*"
msgstr "小於等於 *x* 的最大 :class:`~numbers.Integral`"
#: ../../library/stdtypes.rst:378
msgid ":func:`math.ceil(x) <math.ceil>`"
msgstr ":func:`math.ceil(x) <math.ceil>`"
#: ../../library/stdtypes.rst:378
msgid "the least :class:`~numbers.Integral` >= *x*"
msgstr "大於等於 *x* 的最小 :class:`~numbers.Integral`"
#: ../../library/stdtypes.rst:382
msgid ""
"For additional numeric operations see the :mod:`math` and :mod:`cmath` "
"modules."
msgstr "關於其他數值運算請詳見 :mod:`math` 及 :mod:`cmath` modules(模組)。"
#: ../../library/stdtypes.rst:391
msgid "Bitwise Operations on Integer Types"
msgstr "整數型別的位元運算"
#: ../../library/stdtypes.rst:405
msgid ""
"Bitwise operations only make sense for integers. The result of bitwise "
"operations is calculated as though carried out in two's complement with an "
"infinite number of sign bits."
msgstr ""
"位元運算只對整數有意義。位元運算的計算結果就如同對二的補數執行無窮多個符號位"
"元。"
#: ../../library/stdtypes.rst:409
msgid ""
"The priorities of the binary bitwise operations are all lower than the "
"numeric operations and higher than the comparisons; the unary operation "
"``~`` has the same priority as the other unary numeric operations (``+`` and "
"``-``)."
msgstr ""
"二元位元運算的優先順序皆低於數字運算,但高於比較運算;一元運算 ``~`` 與其他一"
"元數值運算有一致的優先順序(``+`` 及 ``-``)。"
#: ../../library/stdtypes.rst:413
msgid "This table lists the bitwise operations sorted in ascending priority:"
msgstr "這個表格列出所有位元運算並以優先順序由先至後排序。"
#: ../../library/stdtypes.rst:418
msgid "``x | y``"
msgstr "``x | y``"
#: ../../library/stdtypes.rst:418
msgid "bitwise :dfn:`or` of *x* and *y*"
msgstr "*x* 及 *y* 的位元 :dfn:`或`"
#: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421
#: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1216
#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:2458
#: ../../library/stdtypes.rst:3673 ../../library/stdtypes.rst:3677
msgid "\\(4)"
msgstr "\\(4)"
#: ../../library/stdtypes.rst:421
msgid "``x ^ y``"
msgstr "``x ^ y``"
#: ../../library/stdtypes.rst:421
msgid "bitwise :dfn:`exclusive or` of *x* and *y*"
msgstr "*x* 及 *y* 的位元 :dfn:`邏輯互斥或`"
#: ../../library/stdtypes.rst:424
msgid "``x & y``"
msgstr "``x & y``"
#: ../../library/stdtypes.rst:424
msgid "bitwise :dfn:`and` of *x* and *y*"
msgstr "*x* 及 *y* 的位元 :dfn:`與`"
#: ../../library/stdtypes.rst:427
msgid "``x << n``"
msgstr "``x << n``"
#: ../../library/stdtypes.rst:427
msgid "*x* shifted left by *n* bits"
msgstr "*x* 往左移動 *n* 個位元"
#: ../../library/stdtypes.rst:427
msgid "(1)(2)"
msgstr "(1)(2)"
#: ../../library/stdtypes.rst:429
msgid "``x >> n``"
msgstr "``x >> n``"
#: ../../library/stdtypes.rst:429
msgid "*x* shifted right by *n* bits"
msgstr "*x* 往右移動 *n* 個位元"
#: ../../library/stdtypes.rst:429
msgid "(1)(3)"
msgstr "(1)(3)"
#: ../../library/stdtypes.rst:431
msgid "``~x``"
msgstr "``~x``"
#: ../../library/stdtypes.rst:431
msgid "the bits of *x* inverted"
msgstr "反轉 *x* 的位元"
#: ../../library/stdtypes.rst:437
msgid ""
"Negative shift counts are illegal and cause a :exc:`ValueError` to be raised."
msgstr "負數位移是不被允許並會引發 :exc:`ValueError` 的錯誤。"
#: ../../library/stdtypes.rst:440
msgid ""
"A left shift by *n* bits is equivalent to multiplication by ``pow(2, n)``."
msgstr "向左移動 *n* 個位元等同於乘以 ``pow(2, n)``。"
#: ../../library/stdtypes.rst:443
msgid ""
"A right shift by *n* bits is equivalent to floor division by ``pow(2, n)``."
msgstr "向右移動 *n* 個位元等同於向下除法除以 ``pow(2, n)``。"
#: ../../library/stdtypes.rst:446
msgid ""
"Performing these calculations with at least one extra sign extension bit in "
"a finite two's complement representation (a working bit-width of ``1 + max(x."
"bit_length(), y.bit_length())`` or more) is sufficient to get the same "
"result as if there were an infinite number of sign bits."
msgstr ""
"在有限的二的補數表示法中執行這些計算(一個有效位元寬度為 ``1 + max(x."
"bit_length(), y.bit_length())`` 或以上)並至少有一個額外的符號擴展位元,便足"
"以得到與無窮多個符號位元相同的結果。"
#: ../../library/stdtypes.rst:453
msgid "Additional Methods on Integer Types"
msgstr "整數型別的附加 methods"
#: ../../library/stdtypes.rst:455
msgid ""
"The int type implements the :class:`numbers.Integral` :term:`abstract base "
"class`. In addition, it provides a few more methods:"
msgstr ""
"整數型別實作了 :class:`numbers.Integral` :term:`抽象基底類別 <abstract base "
"class>`。此外,它提供了一些 methods:"
#: ../../library/stdtypes.rst:460
msgid ""
"Return the number of bits necessary to represent an integer in binary, "
"excluding the sign and leading zeros::"
msgstr "回傳以二進位表示一個整數所需要的位元數,不包括符號及首位的零: ::"
#: ../../library/stdtypes.rst:463
msgid ""
">>> n = -37\n"
">>> bin(n)\n"
"'-0b100101'\n"
">>> n.bit_length()\n"
"6"
msgstr ""
">>> n = -37\n"
">>> bin(n)\n"
"'-0b100101'\n"
">>> n.bit_length()\n"
"6"
#: ../../library/stdtypes.rst:469
msgid ""
"More precisely, if ``x`` is nonzero, then ``x.bit_length()`` is the unique "
"positive integer ``k`` such that ``2**(k-1) <= abs(x) < 2**k``. "
"Equivalently, when ``abs(x)`` is small enough to have a correctly rounded "
"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then ``x."
"bit_length()`` returns ``0``."
msgstr ""
"更準確來說,若 ``x`` 非為零,則 ``x.bit_length()`` 會得出滿足 ``2**(k-1) <= "
"abs(x) < 2**k`` 的單一正整數 ``k``。同樣地,當 ``abs(x)`` 足夠小到能正確地取"
"得捨入的對數,則 ``k = 1 + int(log(abs(x), 2))``。若 ``x`` 為零,則 ``x."
"bit_length()`` 會回傳 ``0``。"
#: ../../library/stdtypes.rst:475 ../../library/stdtypes.rst:498
#: ../../library/stdtypes.rst:543 ../../library/stdtypes.rst:587
msgid "Equivalent to::"
msgstr "等同於: ::"
#: ../../library/stdtypes.rst:477
msgid ""
"def bit_length(self):\n"
" s = bin(self) # binary representation: bin(-37) --> '-0b100101'\n"
" s = s.lstrip('-0b') # remove leading zeros and minus sign\n"
" return len(s) # len('100101') --> 6"
msgstr ""
#: ../../library/stdtypes.rst:486
msgid ""
"Return the number of ones in the binary representation of the absolute value "
"of the integer. This is also known as the population count. Example::"
msgstr "回傳在絕對值表示的二進位中 1 的個數。這也被稱作母體計數。舉例來說: ::"
#: ../../library/stdtypes.rst:490
msgid ""
">>> n = 19\n"
">>> bin(n)\n"
"'0b10011'\n"
">>> n.bit_count()\n"
"3\n"
">>> (-n).bit_count()\n"
"3"
msgstr ""
">>> n = 19\n"
">>> bin(n)\n"
"'0b10011'\n"
">>> n.bit_count()\n"
"3\n"
">>> (-n).bit_count()\n"
"3"
#: ../../library/stdtypes.rst:500
msgid ""
"def bit_count(self):\n"
" return bin(self).count(\"1\")"
msgstr ""
"def bit_count(self):\n"
" return bin(self).count(\"1\")"
#: ../../library/stdtypes.rst:507
msgid "Return an array of bytes representing an integer."
msgstr "回傳表示一個整數的一列位元組。"
#: ../../library/stdtypes.rst:519
msgid ""
"The integer is represented using *length* bytes, and defaults to 1. An :exc:"
"`OverflowError` is raised if the integer is not representable with the given "
"number of bytes."
msgstr ""
"此整數會使用 *length* 位元組表示,並且預設為 1。如果該整數無法用給定的位元組"
"數來表示,則會引發 :exc:`OverflowError`。"
#: ../../library/stdtypes.rst:523
msgid ""
"The *byteorder* argument determines the byte order used to represent the "
"integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the "
"most significant byte is at the beginning of the byte array. If *byteorder* "
"is ``\"little\"``, the most significant byte is at the end of the byte array."
msgstr ""
"*byteorder* 引數決定了用來表示整數的位元組順序並且預設為 ``\"big\"``。如果 "
"byteorder 是 ``\"big\"``,最重要的位元組位於位元組陣列的開頭。如果 byteorder "
"是 ``\"little\"``,最重要的位元組位於位元組陣列的結尾。"
#: ../../library/stdtypes.rst:529
msgid ""
"The *signed* argument determines whether two's complement is used to "
"represent the integer. If *signed* is ``False`` and a negative integer is "
"given, an :exc:`OverflowError` is raised. The default value for *signed* is "
"``False``."
msgstr ""
"*signed* 引數決定是否使用二的補數來表示整數。如果 *signed* 是 ``False`` 並且"
"給定了一個負整數,則會引發 :exc:`OverflowError`。*signed* 的預設值是 "
"``False``。"
#: ../../library/stdtypes.rst:534
msgid ""
"The default values can be used to conveniently turn an integer into a single "
"byte object::"
msgstr "預設值可以方便地將一個整數轉換為單一位元組物件: ::"
#: ../../library/stdtypes.rst:537
msgid ""
">>> (65).to_bytes()\n"
"b'A'"
msgstr ""
">>> (65).to_bytes()\n"
"b'A'"
#: ../../library/stdtypes.rst:540
msgid ""
"However, when using the default arguments, don't try to convert a value "
"greater than 255 or you'll get an :exc:`OverflowError`."
msgstr ""
"然而,使用預設引數時,不要嘗試轉換大於 255 的值,否則你將會得到一個 :exc:"
"`OverflowError`。"
#: ../../library/stdtypes.rst:545
msgid ""
"def to_bytes(n, length=1, byteorder='big', signed=False):\n"
" if byteorder == 'little':\n"
" order = range(length)\n"
" elif byteorder == 'big':\n"
" order = reversed(range(length))\n"
" else:\n"
" raise ValueError(\"byteorder must be either 'little' or 'big'\")\n"
"\n"
" return bytes((n >> i*8) & 0xff for i in order)"
msgstr ""
"def to_bytes(n, length=1, byteorder='big', signed=False):\n"
" if byteorder == 'little':\n"