-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathexpressions.po
2354 lines (2047 loc) · 124 KB
/
expressions.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-2018, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-30 05:56+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Naoki INADA <[email protected]>, 2017\n"
"Language-Team: Japanese (https://www.transifex.com/python-doc/teams/5390/ja/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ja\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../reference/expressions.rst:6
msgid "Expressions"
msgstr "式 (expression)"
#: ../../reference/expressions.rst:10
msgid ""
"This chapter explains the meaning of the elements of expressions in Python."
msgstr "この章では、Python の式における個々の要素の意味について解説します。"
#: ../../reference/expressions.rst:12
msgid ""
"**Syntax Notes:** In this and the following chapters, extended BNF notation "
"will be used to describe syntax, not lexical analysis. When (one "
"alternative of) a syntax rule has the form"
msgstr ""
"**表記法に関する注意:** この章と以降の章での拡張BNF (extended BNF) "
"表記は、字句解析規則ではなく、構文規則を記述するために用いられています。ある構文規則 (のある表現方法) が、以下の形式"
#: ../../reference/expressions.rst:19
msgid ""
"and no semantics are given, the semantics of this form of ``name`` are the "
"same as for ``othername``."
msgstr ""
"で記述されていて、この構文特有の意味付け (semantics) が記述されていない場合、 ``name`` の形式をとる構文の意味付けは "
"``othername`` の意味付けと同じになります。"
#: ../../reference/expressions.rst:26
msgid "Arithmetic conversions"
msgstr "算術変換 (arithmetic conversion)"
#: ../../reference/expressions.rst:30
msgid ""
"When a description of an arithmetic operator below uses the phrase \"the "
"numeric arguments are converted to a common type,\" this means that the "
"operator implementation for built-in types works as follows:"
msgstr "以下の算術演算子の記述で、「数値引数は共通の型に変換されます」と書かれているとき、組み込み型に対する演算子の実装は以下の通りに動作します:"
#: ../../reference/expressions.rst:34
msgid ""
"If either argument is a complex number, the other is converted to complex;"
msgstr "片方の引数が複素数型であれば、他方は複素数型に変換されます;"
#: ../../reference/expressions.rst:36
msgid ""
"otherwise, if either argument is a floating point number, the other is "
"converted to floating point;"
msgstr "それ以外の場合で、片方の引数が浮動小数点数であれば、他方は浮動小数点型に変換されます;"
#: ../../reference/expressions.rst:39
msgid "otherwise, both must be integers and no conversion is necessary."
msgstr "それ以外場合は、両方の引数は整数でなければならず、変換の必要はありません。"
#: ../../reference/expressions.rst:41
msgid ""
"Some additional rules apply for certain operators (e.g., a string as a left "
"argument to the '%' operator). Extensions must define their own conversion "
"behavior."
msgstr ""
"特定の演算子 ('%' 演算子の左引数としての文字列) "
"には、さらに別の規則が適用されます。拡張は、それ自身の型変換のふるまいを定義していなければなりません。"
#: ../../reference/expressions.rst:49
msgid "Atoms"
msgstr "アトム、原子的要素 (atom)"
#: ../../reference/expressions.rst:53
msgid ""
"Atoms are the most basic elements of expressions. The simplest atoms are "
"identifiers or literals. Forms enclosed in parentheses, brackets or braces "
"are also categorized syntactically as atoms. The syntax for atoms is:"
msgstr ""
"atom は、式の一番基本的な要素です。もっとも単純な atom は、識別子またはリテラルです。丸括弧、角括弧、または波括弧で囲われた形式 (form)"
" もまた、構文上アトムに分類されます。atom の構文は以下のようになります:"
#: ../../reference/expressions.rst:66
msgid "Identifiers (Names)"
msgstr "識別子 (identifier、または名前 (name))"
#: ../../reference/expressions.rst:70
msgid ""
"An identifier occurring as an atom is a name. See section "
":ref:`identifiers` for lexical definition and section :ref:`naming` for "
"documentation of naming and binding."
msgstr ""
"アトムの形になっている識別子 (identifier) は名前 (name) です。字句定義については :ref:`identifiers` "
"節を、名前付けや束縛については :ref:`naming` 節を参照してください。"
#: ../../reference/expressions.rst:76
msgid ""
"When the name is bound to an object, evaluation of the atom yields that "
"object. When a name is not bound, an attempt to evaluate it raises a "
":exc:`NameError` exception."
msgstr ""
"名前があるオブジェクトに束縛されている場合、名前 atom を評価するとそのオブジェクトになります。名前が束縛されていない場合、 atom "
"を評価しようとすると :exc:`NameError` 例外を送出します。"
#: ../../reference/expressions.rst:84
msgid ""
"**Private name mangling:** When an identifier that textually occurs in a "
"class definition begins with two or more underscore characters and does not "
"end in two or more underscores, it is considered a :dfn:`private name` of "
"that class. Private names are transformed to a longer form before code is "
"generated for them. The transformation inserts the class name, with leading"
" underscores removed and a single underscore inserted, in front of the name."
" For example, the identifier ``__spam`` occurring in a class named ``Ham`` "
"will be transformed to ``_Ham__spam``. This transformation is independent "
"of the syntactical context in which the identifier is used. If the "
"transformed name is extremely long (longer than 255 characters), "
"implementation defined truncation may happen. If the class name consists "
"only of underscores, no transformation is done."
msgstr ""
"**プライベートな名前のマングリング:** "
"クラス定義内に書かれた識別子で、2つ以上のアンダースコアから始まり、末尾が2つ以上のアンダースコアで終わっていないものは、そのクラスの "
":dfn:`プライベートな名前` "
"とみなされます。プライベートな名前は、コードが生成される前により長い形式に変換されます。この変換によって、クラス名の先頭にアンダースコアがあれば除去し、先頭にアンダースコアを1つ付加し、名前の前に挿入されます。例えば、クラス名"
" ``Ham`` の中の識別子 ``__spam`` は、``_Ham__spam`` "
"に変換されます。変換は識別子が使用されている構文のコンテキストからは独立しています。変換された名前が非常に長い (255文字を超える) "
"場合、実装によっては名前の切り詰めが行われるかもしれません。クラス名がアンダースコアのみから成る場合は変換は行われません。"
#: ../../reference/expressions.rst:100
msgid "Literals"
msgstr "リテラル"
#: ../../reference/expressions.rst:104
msgid ""
"Python supports string and bytes literals and various numeric literals:"
msgstr "Python では、文字列やバイト列リテラルと、様々な数値リテラルをサポートしています:"
#: ../../reference/expressions.rst:110
msgid ""
"Evaluation of a literal yields an object of the given type (string, bytes, "
"integer, floating point number, complex number) with the given value. The "
"value may be approximated in the case of floating point and imaginary "
"(complex) literals. See section :ref:`literals` for details."
msgstr ""
"リテラルの評価は、与えられた型 (文字列、バイト列、整数、浮動小数点数、複素数) の与えられた値を持つオブジェクトを与えます。浮動小数点や虚数 "
"(複素数) リテラルの場合、値は近似値になる場合があります。詳しくは :ref:`literals` を参照してください。"
#: ../../reference/expressions.rst:119
msgid ""
"All literals correspond to immutable data types, and hence the object's "
"identity is less important than its value. Multiple evaluations of literals"
" with the same value (either the same occurrence in the program text or a "
"different occurrence) may obtain the same object or a different object with "
"the same value."
msgstr ""
"リテラルは全て変更不能なデータ型に対応します。このため、オブジェクトのアイデンティティはオブジェクトの値ほど重要ではありません。同じ値を持つ複数のリテラルを評価した場合、(それらのリテラルがプログラムの同じ場所由来のものであっても、そうでなくても)"
" 同じオブジェクトを指しているか、まったく同じ値を持つ別のオブジェクトになります。"
#: ../../reference/expressions.rst:129
msgid "Parenthesized forms"
msgstr "丸括弧形式 (parenthesized form)"
#: ../../reference/expressions.rst:133
msgid ""
"A parenthesized form is an optional expression list enclosed in parentheses:"
msgstr "丸括弧形式とは、式リストの一形態で、丸括弧で囲ったものです:"
#: ../../reference/expressions.rst:138
msgid ""
"A parenthesized expression list yields whatever that expression list yields:"
" if the list contains at least one comma, it yields a tuple; otherwise, it "
"yields the single expression that makes up the expression list."
msgstr ""
"丸括弧で囲われた式のリストは、個々の式が表現するものになります: リスト内に少なくとも一つのカンマが入っていた場合、タプルになります; "
"そうでない場合、式のリストを構成している単一の式自体の値になります。"
#: ../../reference/expressions.rst:144
msgid ""
"An empty pair of parentheses yields an empty tuple object. Since tuples are"
" immutable, the rules for literals apply (i.e., two occurrences of the empty"
" tuple may or may not yield the same object)."
msgstr ""
"中身が空の丸括弧のペアは、空のタプルオブジェクトを表します。タプルは変更不能なので、リテラルと同じ規則が適用されます "
"(すなわち、空のタプルが二箇所で使われると、それらは同じオブジェクトになることもあるし、ならないこともあります)。"
#: ../../reference/expressions.rst:152
msgid ""
"Note that tuples are not formed by the parentheses, but rather by use of the"
" comma operator. The exception is the empty tuple, for which parentheses "
"*are* required --- allowing unparenthesized \"nothing\" in expressions would"
" cause ambiguities and allow common typos to pass uncaught."
msgstr ""
"タプルは丸括弧で作成されるのではなく、カンマによって作成されることに注意してください。例外は空のタプルで、この場合には丸括弧が *必要です* --- "
"丸括弧のつかない \"何も記述しない式 (nothing)\" "
"を使えるようにしてしまうと、文法があいまいなものになってしまい、よくあるタイプミスが検出されなくなってしまいます。"
#: ../../reference/expressions.rst:161
msgid "Displays for lists, sets and dictionaries"
msgstr "リスト、集合、辞書の表示"
#: ../../reference/expressions.rst:163
msgid ""
"For constructing a list, a set or a dictionary Python provides special "
"syntax called \"displays\", each of them in two flavors:"
msgstr ""
"Python は、リスト、集合、または辞書を構成するために、 \"表示 (display)\" "
"と呼ばれる特殊な構文を、それぞれ二種類づつ提供していて、コンテナの内容は:"
#: ../../reference/expressions.rst:166
msgid "either the container contents are listed explicitly, or"
msgstr "明示的に列挙される、または"
#: ../../reference/expressions.rst:168
msgid ""
"they are computed via a set of looping and filtering instructions, called a "
":dfn:`comprehension`."
msgstr ":dfn:`内包表記 (comprehension)` と呼ばれる、ループ処理とフィルター処理の命令の組み合わせを通じて計算されます。"
#: ../../reference/expressions.rst:171
msgid "Common syntax elements for comprehensions are:"
msgstr "内包表記の共通の構文要素はこの通りです:"
#: ../../reference/expressions.rst:179
msgid ""
"The comprehension consists of a single expression followed by at least one "
":keyword:`for` clause and zero or more :keyword:`for` or :keyword:`if` "
"clauses. In this case, the elements of the new container are those that "
"would be produced by considering each of the :keyword:`for` or :keyword:`if`"
" clauses a block, nesting from left to right, and evaluating the expression "
"to produce an element each time the innermost block is reached."
msgstr ""
"内包表記はまず単一の式、続いて少なくとも 1 個の :keyword:`for` 節、さらに続いて 0 個以上の :keyword:`for` 節あるいは :keyword:`if` 節からなります。\n"
"この場合、各々の :keyword:`for` や :keyword:`if` 節を、左から右へ深くなっていくネストしたブロックとみなし、ネストの最内のブロックに到達するごとに内包表記の先頭にある式を評価した結果が、最終的にできあがるコンテナの各要素になります。"
#: ../../reference/expressions.rst:186
msgid ""
"However, aside from the iterable expression in the leftmost :keyword:`for` "
"clause, the comprehension is executed in a separate implicitly nested scope."
" This ensures that names assigned to in the target list don't \"leak\" into "
"the enclosing scope."
msgstr ""
#: ../../reference/expressions.rst:190
msgid ""
"The iterable expression in the leftmost :keyword:`for` clause is evaluated "
"directly in the enclosing scope and then passed as an argument to the "
"implictly nested scope. Subsequent :keyword:`for` clauses and any filter "
"condition in the leftmost :keyword:`for` clause cannot be evaluated in the "
"enclosing scope as they may depend on the values obtained from the leftmost "
"iterable. For example: ``[x*y for x in range(10) for y in range(x, x+10)]``."
msgstr ""
#: ../../reference/expressions.rst:197
msgid ""
"To ensure the comprehension always results in a container of the appropriate"
" type, ``yield`` and ``yield from`` expressions are prohibited in the "
"implicitly nested scope (in Python 3.7, such expressions emit "
":exc:`DeprecationWarning` when compiled, in Python 3.8+ they will emit "
":exc:`SyntaxError`)."
msgstr ""
#: ../../reference/expressions.rst:202
msgid ""
"Since Python 3.6, in an :keyword:`async def` function, an :keyword:`async "
"for` clause may be used to iterate over a :term:`asynchronous iterator`. A "
"comprehension in an :keyword:`async def` function may consist of either a "
":keyword:`for` or :keyword:`async for` clause following the leading "
"expression, may contain additional :keyword:`for` or :keyword:`async for` "
"clauses, and may also use :keyword:`await` expressions. If a comprehension "
"contains either :keyword:`async for` clauses or :keyword:`await` expressions"
" it is called an :dfn:`asynchronous comprehension`. An asynchronous "
"comprehension may suspend the execution of the coroutine function in which "
"it appears. See also :pep:`530`."
msgstr ""
#: ../../reference/expressions.rst:214
msgid "Asynchronous comprehensions were introduced."
msgstr ""
#: ../../reference/expressions.rst:217 ../../reference/expressions.rst:371
msgid ""
"``yield`` and ``yield from`` deprecated in the implicitly nested scope."
msgstr ""
#: ../../reference/expressions.rst:224
msgid "List displays"
msgstr "リスト表現"
#: ../../reference/expressions.rst:232
msgid ""
"A list display is a possibly empty series of expressions enclosed in square "
"brackets:"
msgstr "リスト表現は、角括弧で囲われた式の系列です。系列は空の系列であってもかまいません:"
#: ../../reference/expressions.rst:238
msgid ""
"A list display yields a new list object, the contents being specified by "
"either a list of expressions or a comprehension. When a comma-separated "
"list of expressions is supplied, its elements are evaluated from left to "
"right and placed into the list object in that order. When a comprehension "
"is supplied, the list is constructed from the elements resulting from the "
"comprehension."
msgstr ""
"リスト表示は、新しいリストオブジェクトを与えます。リストの内容は、式のリストまたはリスト内包表記 (list comprehension) で指定されます。\n"
"カンマで区切られた式のリストが与えられたときは、それらの各要素は左から右へと順に評価され、その順にリスト内に配置されます。\n"
"内包表記が与えられたときは、内包表記の結果の要素でリストが構成されます。"
#: ../../reference/expressions.rst:248
msgid "Set displays"
msgstr "集合表現"
#: ../../reference/expressions.rst:253
msgid ""
"A set display is denoted by curly braces and distinguishable from dictionary"
" displays by the lack of colons separating keys and values:"
msgstr "集合表現は波括弧で表され、キーと値を分けるコロンがないことで辞書表現と区別されます:"
#: ../../reference/expressions.rst:259
msgid ""
"A set display yields a new mutable set object, the contents being specified "
"by either a sequence of expressions or a comprehension. When a comma-"
"separated list of expressions is supplied, its elements are evaluated from "
"left to right and added to the set object. When a comprehension is "
"supplied, the set is constructed from the elements resulting from the "
"comprehension."
msgstr ""
"集合表示は、新しいミュータブルな集合オブジェクトを与えます。集合の内容は、式の並びまたは内包表記によって指定されます。\n"
"カンマ区切りの式のリストが与えられたときは、その要素は左から右へ順に評価され、集合オブジェクトに加えられます。\n"
"内包表記が与えられたときは、内包表記の結果の要素で集合が構成されます。"
#: ../../reference/expressions.rst:265
msgid ""
"An empty set cannot be constructed with ``{}``; this literal constructs an "
"empty dictionary."
msgstr "空集合は ``{}`` で構成できません。このリテラルは空の辞書を構成します。"
#: ../../reference/expressions.rst:272
msgid "Dictionary displays"
msgstr "辞書表現"
#: ../../reference/expressions.rst:278
msgid ""
"A dictionary display is a possibly empty series of key/datum pairs enclosed "
"in curly braces:"
msgstr "辞書表現は、波括弧で囲われた、キーと値のペアからなる系列です。系列は空の系列であってもかまいません:"
#: ../../reference/expressions.rst:287
msgid "A dictionary display yields a new dictionary object."
msgstr "辞書表現は、新たな辞書オブジェクトを表します。"
#: ../../reference/expressions.rst:289
msgid ""
"If a comma-separated sequence of key/datum pairs is given, they are "
"evaluated from left to right to define the entries of the dictionary: each "
"key object is used as a key into the dictionary to store the corresponding "
"datum. This means that you can specify the same key multiple times in the "
"key/datum list, and the final dictionary's value for that key will be the "
"last one given."
msgstr ""
"キーとデータからなる対の並びがカンマ区切りで与えられたときは、その要素は左から右へ評価され、辞書のエントリーを定義します。すなわち、それぞれのキーオブジェクトが、辞書内で対応するデータを保存するキーとして使われます。\n"
"これにより、キーとデータのリストの中で同じキーを複数回指定することができ、そのキーに対する最終的な辞書の値は、最後に与えられたものになります。"
#: ../../reference/expressions.rst:297
msgid ""
"A double asterisk ``**`` denotes :dfn:`dictionary unpacking`. Its operand "
"must be a :term:`mapping`. Each mapping item is added to the new "
"dictionary. Later values replace values already set by earlier key/datum "
"pairs and earlier dictionary unpackings."
msgstr ""
"ダブルアスタリスク ``**`` は :dfn:`辞書のアンパック` を表します。このとき被演算子は :term:`mapping` "
"でなければなりません。それぞれのmappingの要素は、新たな辞書に追加されます。キー/データの対もしくは辞書のアンパックによって先に追加された値は、後から追加された値によって上書きされます。"
#: ../../reference/expressions.rst:302
msgid "Unpacking into dictionary displays, originally proposed by :pep:`448`."
msgstr ""
#: ../../reference/expressions.rst:305
msgid ""
"A dict comprehension, in contrast to list and set comprehensions, needs two "
"expressions separated with a colon followed by the usual \"for\" and \"if\" "
"clauses. When the comprehension is run, the resulting key and value elements"
" are inserted in the new dictionary in the order they are produced."
msgstr ""
"辞書内包表記は、リストや集合の内包表記とは対照的に、通常の \"for\" や \"if\" 節の前に、コロンで分けられた 2 "
"つの式が必要です。内包表記が起動すると、結果のキーと値の要素が、作られた順に新しい辞書に挿入されます。"
#: ../../reference/expressions.rst:313
msgid ""
"Restrictions on the types of the key values are listed earlier in section "
":ref:`types`. (To summarize, the key type should be :term:`hashable`, which"
" excludes all mutable objects.) Clashes between duplicate keys are not "
"detected; the last datum (textually rightmost in the display) stored for a "
"given key value prevails."
msgstr ""
"キーの値として使える型に関する制限は :ref:`types` 節ですでに列挙しています。(一言でいうと、キーは変更可能なオブジェクトを全て排除した "
":term:`hashable` でなければなりません。) 重複するキー間で衝突が起きても、衝突が検出されることはありません; "
"あるキーに対して、最後に渡されたデータ (プログラムテキスト上では、辞書表記の最も右側値となるもの) が使われます。"
#: ../../reference/expressions.rst:323
msgid "Generator expressions"
msgstr "ジェネレータ式"
#: ../../reference/expressions.rst:328
msgid "A generator expression is a compact generator notation in parentheses:"
msgstr "ジェネレータ式 (generator expression) とは、丸括弧を使ったコンパクトなジェネレータ表記法です:"
#: ../../reference/expressions.rst:333
msgid ""
"A generator expression yields a new generator object. Its syntax is the "
"same as for comprehensions, except that it is enclosed in parentheses "
"instead of brackets or curly braces."
msgstr "ジェネレータ式は新たなジェネレータオブジェクトを与えます。この構文は内包表記とほぼ同じですが、角括弧や波括弧ではなく、丸括弧で囲まれます。"
#: ../../reference/expressions.rst:337
msgid ""
"Variables used in the generator expression are evaluated lazily when the "
":meth:`~generator.__next__` method is called for the generator object (in "
"the same fashion as normal generators). However, the iterable expression in"
" the leftmost :keyword:`for` clause is immediately evaluated, so that an "
"error produced by it will be emitted at the point where the generator "
"expression is defined, rather than at the point where the first value is "
"retrieved. Subsequent :keyword:`for` clauses and any filter condition in the"
" leftmost :keyword:`for` clause cannot be evaluated in the enclosing scope "
"as they may depend on the values obtained from the leftmost iterable. For "
"example: ``(x*y for x in range(10) for y in range(x, x+10))``."
msgstr ""
#: ../../reference/expressions.rst:348
msgid ""
"The parentheses can be omitted on calls with only one argument. See section"
" :ref:`calls` for details."
msgstr "関数の唯一の引数として渡す場合には、丸括弧を省略できます。詳しくは :ref:`calls` 節を参照してください。"
#: ../../reference/expressions.rst:351
msgid ""
"To avoid interfering with the expected operation of the generator expression"
" itself, ``yield`` and ``yield from`` expressions are prohibited in the "
"implicitly defined generator (in Python 3.7, such expressions emit "
":exc:`DeprecationWarning` when compiled, in Python 3.8+ they will emit "
":exc:`SyntaxError`)."
msgstr ""
#: ../../reference/expressions.rst:357
msgid ""
"If a generator expression contains either :keyword:`async for` clauses or "
":keyword:`await` expressions it is called an :dfn:`asynchronous generator "
"expression`. An asynchronous generator expression returns a new "
"asynchronous generator object, which is an asynchronous iterator (see :ref"
":`async-iterators`)."
msgstr ""
#: ../../reference/expressions.rst:363
msgid "Asynchronous generator expressions were introduced."
msgstr ""
#: ../../reference/expressions.rst:366
msgid ""
"Prior to Python 3.7, asynchronous generator expressions could only appear in"
" :keyword:`async def` coroutines. Starting with 3.7, any function can use "
"asynchronous generator expressions."
msgstr ""
#: ../../reference/expressions.rst:378
msgid "Yield expressions"
msgstr "Yield 式"
#: ../../reference/expressions.rst:389
msgid ""
"The yield expression is used when defining a :term:`generator` function or "
"an :term:`asynchronous generator` function and thus can only be used in the "
"body of a function definition. Using a yield expression in a function's "
"body causes that function to be a generator, and using it in an "
":keyword:`async def` function's body causes that coroutine function to be an"
" asynchronous generator. For example::"
msgstr ""
#: ../../reference/expressions.rst:402
msgid ""
"Due to their side effects on the containing scope, ``yield`` expressions are"
" not permitted as part of the implicitly defined scopes used to implement "
"comprehensions and generator expressions (in Python 3.7, such expressions "
"emit :exc:`DeprecationWarning` when compiled, in Python 3.8+ they will emit "
":exc:`SyntaxError`).."
msgstr ""
#: ../../reference/expressions.rst:408
msgid ""
"Yield expressions deprecated in the implicitly nested scopes used to "
"implement comprehensions and generator expressions."
msgstr ""
#: ../../reference/expressions.rst:412
msgid ""
"Generator functions are described below, while asynchronous generator "
"functions are described separately in section :ref:`asynchronous-generator-"
"functions`."
msgstr ""
#: ../../reference/expressions.rst:416
msgid ""
"When a generator function is called, it returns an iterator known as a "
"generator. That generator then controls the execution of the generator "
"function. The execution starts when one of the generator's methods is "
"called. At that time, the execution proceeds to the first yield expression,"
" where it is suspended again, returning the value of "
":token:`expression_list` to the generator's caller. By suspended, we mean "
"that all local state is retained, including the current bindings of local "
"variables, the instruction pointer, the internal evaluation stack, and the "
"state of any exception handling. When the execution is resumed by calling "
"one of the generator's methods, the function can proceed exactly as if the "
"yield expression were just another external call. The value of the yield "
"expression after resuming depends on the method which resumed the execution."
" If :meth:`~generator.__next__` is used (typically via either a "
":keyword:`for` or the :func:`next` builtin) then the result is "
":const:`None`. Otherwise, if :meth:`~generator.send` is used, then the "
"result will be the value passed in to that method."
msgstr ""
"ジェネレータ関数が呼び出された時、ジェネレータとしてのイテレータを返します。ジェネレータはその後ジェネレータ関数の実行を制御します。ジェネレータのメソッドが呼び出されると実行が開始されます。開始されると、最初の"
" yield 式まで処理して一時停止し、呼び出し元へ :token:`expression_list` "
"の値を返します。ここで言う一時停止とは、ローカル変数の束縛、命令ポインタや内部の評価スタック、そして例外処理のを含むすべてのローカル状態が保持されることを意味します。再度、ジェネレータのメソッドが呼び出されて実行を再開した時、ジェネレータは"
" yield 式がただの外部呼び出しであったかのように処理を継続します。再開後の yield "
"式の値は実行を再開するメソッドに依存します。:meth:`~generator.__next__` を使用した場合 (一般に "
":keyword:`for` 文や組み込み関数 :func:`next` など) の結果は :const:`None` "
"となり、:meth:`~generator.send` を使用した場合はそのメソッドに渡された値が結果になります。"
#: ../../reference/expressions.rst:435
msgid ""
"All of this makes generator functions quite similar to coroutines; they "
"yield multiple times, they have more than one entry point and their "
"execution can be suspended. The only difference is that a generator "
"function cannot control where the execution should continue after it yields;"
" the control is always transferred to the generator's caller."
msgstr ""
"これまで説明した内容から、ジェネレータ関数はコルーチンにとてもよく似ています。ジェネレータ関数は何度も生成し、1つ以上のエントリポイントを持ち、その実行は一時停止されます。ジェネレータ関数は"
" yield した後で実行の継続を制御できないことが唯一の違いです。その制御は常にジェネレータの呼び出し元へ移されます。"
#: ../../reference/expressions.rst:441
msgid ""
"Yield expressions are allowed anywhere in a :keyword:`try` construct. If "
"the generator is not resumed before it is finalized (by reaching a zero "
"reference count or by being garbage collected), the generator-iterator's "
":meth:`~generator.close` method will be called, allowing any pending "
":keyword:`finally` clauses to execute."
msgstr ""
"yield 式は :keyword:`try` 構造内で使用できます。ジェネレータの (参照カウントがゼロに達するか、ガベージコレクションによる) "
"完了前に再開されない場合、ジェネレータ-イテレータの :meth:`~generator.close` "
"メソッドが呼ばれ、:keyword:`finally` 節が実行されます。"
#: ../../reference/expressions.rst:447
msgid ""
"When ``yield from <expr>`` is used, it treats the supplied expression as a "
"subiterator. All values produced by that subiterator are passed directly to "
"the caller of the current generator's methods. Any values passed in with "
":meth:`~generator.send` and any exceptions passed in with "
":meth:`~generator.throw` are passed to the underlying iterator if it has the"
" appropriate methods. If this is not the case, then :meth:`~generator.send`"
" will raise :exc:`AttributeError` or :exc:`TypeError`, while "
":meth:`~generator.throw` will just raise the passed in exception "
"immediately."
msgstr ""
"``yield from <expr>`` "
"を使用した場合、与えられた式はサブイテレータとして扱われます。サブイテレータによって生成されたすべての値は現在のジェネレータのメソッドの呼び出し元へ直接渡されます。:meth:`~generator.send`"
" で渡されたあらゆる値と :meth:`~generator.throw` "
"で渡されたあらゆる例外は根底のイテレータに適切なメソッドがあれば渡されます。適切なメソッドがない場合、:meth:`~generator.send` は"
" :exc:`AttributeError` か :exc:`TypeError` を、:meth:`~generator.throw` "
"は渡された例外を即座に送出します。"
#: ../../reference/expressions.rst:456
msgid ""
"When the underlying iterator is complete, the :attr:`~StopIteration.value` "
"attribute of the raised :exc:`StopIteration` instance becomes the value of "
"the yield expression. It can be either set explicitly when raising "
":exc:`StopIteration`, or automatically when the sub-iterator is a generator "
"(by returning a value from the sub-generator)."
msgstr ""
"根底のイテレータの完了時、引き起こされた :exc:`StopIteration` インスタンスの "
":attr:`~StopIteration.value` 属性はその yield 式の値となります。 :exc:`StopIteration` "
"を起こす際に明示的にセットされるか、サブイテレータがジェネレータであれば (サブイテレータからかえる値で) 自動的にセットされるかのどちらかです。"
#: ../../reference/expressions.rst:462
msgid "Added ``yield from <expr>`` to delegate control flow to a subiterator."
msgstr "サブイテレータに制御フローを委譲するために ``yield from <expr>`` が追加されました。"
#: ../../reference/expressions.rst:465
msgid ""
"The parentheses may be omitted when the yield expression is the sole "
"expression on the right hand side of an assignment statement."
msgstr "yield 式が代入文の単独の右辺式であるとき、括弧は省略できます。"
#: ../../reference/expressions.rst:471
msgid ":pep:`255` - Simple Generators"
msgstr ":pep:`255` - 単純なジェネレータ"
#: ../../reference/expressions.rst:471
msgid ""
"The proposal for adding generators and the :keyword:`yield` statement to "
"Python."
msgstr "Python へのジェネレータと :keyword:`yield` 文の導入提案。"
#: ../../reference/expressions.rst:475
msgid ":pep:`342` - Coroutines via Enhanced Generators"
msgstr ":pep:`0342` - 拡張されたジェネレータを用いたコルーチン"
#: ../../reference/expressions.rst:474
msgid ""
"The proposal to enhance the API and syntax of generators, making them usable"
" as simple coroutines."
msgstr "シンプルなコルーチンとして利用できるように、ジェネレータの構文と API を拡張する提案です。"
#: ../../reference/expressions.rst:478
msgid ":pep:`380` - Syntax for Delegating to a Subgenerator"
msgstr ":pep:`380` - サブジェネレータへの委譲構文"
#: ../../reference/expressions.rst:478
msgid ""
"The proposal to introduce the :token:`yield_from` syntax, making delegation "
"to sub-generators easy."
msgstr "サブジェネレータの委譲を簡単にするための、 :token:`yield_from` 構文の導入提案。"
#: ../../reference/expressions.rst:485
msgid "Generator-iterator methods"
msgstr "ジェネレータ-イテレータメソッド"
#: ../../reference/expressions.rst:487
msgid ""
"This subsection describes the methods of a generator iterator. They can be "
"used to control the execution of a generator function."
msgstr "この説ではジェネレータイテレータのメソッドについて説明します。これらはジェネレータ関数の実行制御に使用できます。"
#: ../../reference/expressions.rst:490
msgid ""
"Note that calling any of the generator methods below when the generator is "
"already executing raises a :exc:`ValueError` exception."
msgstr ""
"以下のジェネレータメソッドの呼び出しは、ジェネレータが既に実行中の場合 :exc:`ValueError` 例外を送出する点に注意してください。"
#: ../../reference/expressions.rst:498
msgid ""
"Starts the execution of a generator function or resumes it at the last "
"executed yield expression. When a generator function is resumed with a "
":meth:`~generator.__next__` method, the current yield expression always "
"evaluates to :const:`None`. The execution then continues to the next yield "
"expression, where the generator is suspended again, and the value of the "
":token:`expression_list` is returned to :meth:`__next__`'s caller. If the "
"generator exits without yielding another value, a :exc:`StopIteration` "
"exception is raised."
msgstr ""
"ジェネレータ関数の実行を開始するか、最後に yield 式が実行されたところから再開します。ジェネレータ関数が "
":meth:`~generator.__next__` メソッドによって再開された時、その時点の :keyword:`yield` 式の値は常に "
":const:`None` と評価されます。その後次の :keyword:`yield` "
"式まで実行し、ジェネレータは一時停止し、:token:`expression_list` の値を :meth:`__next__` "
"メソッドの呼び出し元に返します。ジェネレータが次の値を yield せずに終了した場合、:exc:`StopIteration` 例外が送出されます。"
#: ../../reference/expressions.rst:507
msgid ""
"This method is normally called implicitly, e.g. by a :keyword:`for` loop, or"
" by the built-in :func:`next` function."
msgstr "このメソッドは通常、例えば :keyword:`for` ループや組み込みの :func:`next` 関数によって暗黙に呼び出されます。"
#: ../../reference/expressions.rst:513
msgid ""
"Resumes the execution and \"sends\" a value into the generator function. "
"The *value* argument becomes the result of the current yield expression. "
"The :meth:`send` method returns the next value yielded by the generator, or "
"raises :exc:`StopIteration` if the generator exits without yielding another "
"value. When :meth:`send` is called to start the generator, it must be "
"called with :const:`None` as the argument, because there is no yield "
"expression that could receive the value."
msgstr ""
"ジェネレータ関数の内部へ値を \"送り\"、実行を再開します。引数の *value* はその時点の yield 式の結果になります。 "
":meth:`send` メソッドは次にジェネレータが生成した値を返し、ジェネレータが次の値を生成することなく終了すると "
":exc:`StopIteration` を送出します。 :meth:`send` が呼び出されてジェネレータが開始するときは、値を受け取る yield"
" 式が存在しないので、 :const:`None` を引数として呼び出さなければなりません。"
#: ../../reference/expressions.rst:524
msgid ""
"Raises an exception of type ``type`` at the point where the generator was "
"paused, and returns the next value yielded by the generator function. If "
"the generator exits without yielding another value, a :exc:`StopIteration` "
"exception is raised. If the generator function does not catch the passed-in"
" exception, or raises a different exception, then that exception propagates "
"to the caller."
msgstr ""
"ジェネレータが中断した位置で ``type`` "
"型の例外を発生させて、そのジェネレータ関数が生成する次の値を返します。ジェネレータが値を生成することなく終了すると "
":exc:`StopIteration` "
"が発生します。ジェネレータ関数が渡された例外を捕捉しない、もしくは違う例外を発生させるなら、その例外は呼び出し元へ伝搬されます。"
#: ../../reference/expressions.rst:535
msgid ""
"Raises a :exc:`GeneratorExit` at the point where the generator function was "
"paused. If the generator function then exits gracefully, is already closed,"
" or raises :exc:`GeneratorExit` (by not catching the exception), close "
"returns to its caller. If the generator yields a value, a "
":exc:`RuntimeError` is raised. If the generator raises any other exception,"
" it is propagated to the caller. :meth:`close` does nothing if the "
"generator has already exited due to an exception or normal exit."
msgstr ""
#: ../../reference/expressions.rst:546
msgid "Examples"
msgstr "使用例"
#: ../../reference/expressions.rst:548
msgid ""
"Here is a simple example that demonstrates the behavior of generators and "
"generator functions::"
msgstr "以下の簡単なサンプルはジェネレータとジェネレータ関数の振る舞いを実際に紹介します::"
#: ../../reference/expressions.rst:575
msgid ""
"For examples using ``yield from``, see :ref:`pep-380` in \"What's New in "
"Python.\""
msgstr ""
"``yield from`` の使用例は、\"What's New in Python.\" の :ref:`pep-380` を参照してください。"
#: ../../reference/expressions.rst:581
msgid "Asynchronous generator functions"
msgstr "非同期ジェネレータ関数 (asynchronous generator function)"
#: ../../reference/expressions.rst:583
msgid ""
"The presence of a yield expression in a function or method defined using "
":keyword:`async def` further defines the function as a :term:`asynchronous "
"generator` function."
msgstr ""
#: ../../reference/expressions.rst:587
msgid ""
"When an asynchronous generator function is called, it returns an "
"asynchronous iterator known as an asynchronous generator object. That object"
" then controls the execution of the generator function. An asynchronous "
"generator object is typically used in an :keyword:`async for` statement in a"
" coroutine function analogously to how a generator object would be used in a"
" :keyword:`for` statement."
msgstr ""
#: ../../reference/expressions.rst:594
msgid ""
"Calling one of the asynchronous generator's methods returns an "
":term:`awaitable` object, and the execution starts when this object is "
"awaited on. At that time, the execution proceeds to the first yield "
"expression, where it is suspended again, returning the value of "
":token:`expression_list` to the awaiting coroutine. As with a generator, "
"suspension means that all local state is retained, including the current "
"bindings of local variables, the instruction pointer, the internal "
"evaluation stack, and the state of any exception handling. When the "
"execution is resumed by awaiting on the next object returned by the "
"asynchronous generator's methods, the function can proceed exactly as if the"
" yield expression were just another external call. The value of the yield "
"expression after resuming depends on the method which resumed the execution."
" If :meth:`~agen.__anext__` is used then the result is :const:`None`. "
"Otherwise, if :meth:`~agen.asend` is used, then the result will be the value"
" passed in to that method."
msgstr ""
#: ../../reference/expressions.rst:610
msgid ""
"In an asynchronous generator function, yield expressions are allowed "
"anywhere in a :keyword:`try` construct. However, if an asynchronous "
"generator is not resumed before it is finalized (by reaching a zero "
"reference count or by being garbage collected), then a yield expression "
"within a :keyword:`try` construct could result in a failure to execute "
"pending :keyword:`finally` clauses. In this case, it is the responsibility "
"of the event loop or scheduler running the asynchronous generator to call "
"the asynchronous generator-iterator's :meth:`~agen.aclose` method and run "
"the resulting coroutine object, thus allowing any pending :keyword:`finally`"
" clauses to execute."
msgstr ""
#: ../../reference/expressions.rst:621
msgid ""
"To take care of finalization, an event loop should define a *finalizer* "
"function which takes an asynchronous generator-iterator and presumably calls"
" :meth:`~agen.aclose` and executes the coroutine. This *finalizer* may be "
"registered by calling :func:`sys.set_asyncgen_hooks`. When first iterated "
"over, an asynchronous generator-iterator will store the registered "
"*finalizer* to be called upon finalization. For a reference example of a "
"*finalizer* method see the implementation of "
"``asyncio.Loop.shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`."
msgstr ""
#: ../../reference/expressions.rst:630
msgid ""
"The expression ``yield from <expr>`` is a syntax error when used in an "
"asynchronous generator function."
msgstr ""
#: ../../reference/expressions.rst:637
msgid "Asynchronous generator-iterator methods"
msgstr ""
#: ../../reference/expressions.rst:639
msgid ""
"This subsection describes the methods of an asynchronous generator iterator,"
" which are used to control the execution of a generator function."
msgstr ""
#: ../../reference/expressions.rst:647
msgid ""
"Returns an awaitable which when run starts to execute the asynchronous "
"generator or resumes it at the last executed yield expression. When an "
"asynchronous generator function is resumed with a :meth:`~agen.__anext__` "
"method, the current yield expression always evaluates to :const:`None` in "
"the returned awaitable, which when run will continue to the next yield "
"expression. The value of the :token:`expression_list` of the yield "
"expression is the value of the :exc:`StopIteration` exception raised by the "
"completing coroutine. If the asynchronous generator exits without yielding "
"another value, the awaitable instead raises an :exc:`StopAsyncIteration` "
"exception, signalling that the asynchronous iteration has completed."
msgstr ""
#: ../../reference/expressions.rst:659
msgid ""
"This method is normally called implicitly by a :keyword:`async for` loop."
msgstr ""
#: ../../reference/expressions.rst:664
msgid ""
"Returns an awaitable which when run resumes the execution of the "
"asynchronous generator. As with the :meth:`~generator.send()` method for a "
"generator, this \"sends\" a value into the asynchronous generator function, "
"and the *value* argument becomes the result of the current yield expression."
" The awaitable returned by the :meth:`asend` method will return the next "
"value yielded by the generator as the value of the raised "
":exc:`StopIteration`, or raises :exc:`StopAsyncIteration` if the "
"asynchronous generator exits without yielding another value. When "
":meth:`asend` is called to start the asynchronous generator, it must be "
"called with :const:`None` as the argument, because there is no yield "
"expression that could receive the value."
msgstr ""
#: ../../reference/expressions.rst:679
msgid ""
"Returns an awaitable that raises an exception of type ``type`` at the point "
"where the asynchronous generator was paused, and returns the next value "
"yielded by the generator function as the value of the raised "
":exc:`StopIteration` exception. If the asynchronous generator exits without"
" yielding another value, an :exc:`StopAsyncIteration` exception is raised by"
" the awaitable. If the generator function does not catch the passed-in "
"exception, or raises a different exception, then when the awaitable is run "
"that exception propagates to the caller of the awaitable."
msgstr ""
#: ../../reference/expressions.rst:694
msgid ""
"Returns an awaitable that when run will throw a :exc:`GeneratorExit` into "
"the asynchronous generator function at the point where it was paused. If the"
" asynchronous generator function then exits gracefully, is already closed, "
"or raises :exc:`GeneratorExit` (by not catching the exception), then the "
"returned awaitable will raise a :exc:`StopIteration` exception. Any further "
"awaitables returned by subsequent calls to the asynchronous generator will "
"raise a :exc:`StopAsyncIteration` exception. If the asynchronous generator "
"yields a value, a :exc:`RuntimeError` is raised by the awaitable. If the "
"asynchronous generator raises any other exception, it is propagated to the "
"caller of the awaitable. If the asynchronous generator has already exited "
"due to an exception or normal exit, then further calls to :meth:`aclose` "
"will return an awaitable that does nothing."
msgstr ""
#: ../../reference/expressions.rst:710
msgid "Primaries"
msgstr "プライマリ"
#: ../../reference/expressions.rst:714
msgid ""
"Primaries represent the most tightly bound operations of the language. Their"
" syntax is:"
msgstr "プライマリは、言語において最も結合の強い操作を表します。文法は以下のようになります:"
#: ../../reference/expressions.rst:724
msgid "Attribute references"
msgstr "属性参照"
#: ../../reference/expressions.rst:728
msgid "An attribute reference is a primary followed by a period and a name:"
msgstr "属性参照は、プライマリの後ろにピリオドと名前を連ねたものです:"
#: ../../reference/expressions.rst:738
msgid ""
"The primary must evaluate to an object of a type that supports attribute "
"references, which most objects do. This object is then asked to produce the"
" attribute whose name is the identifier. This production can be customized "
"by overriding the :meth:`__getattr__` method. If this attribute is not "
"available, the exception :exc:`AttributeError` is raised. Otherwise, the "
"type and value of the object produced is determined by the object. Multiple"
" evaluations of the same attribute reference may yield different objects."
msgstr ""
"プライマリの評価は、属性参照をサポートする型のオブジェクトでなければならず、これにはほとんどのオブジェクトが当てはまります。そしてこのオブジェクトは、名前が指定した識別子名であるような属性を生成しなければなりません。この生成は"
" :meth:`__getattr__` メソッドをオーバーライドすることでカスタマイズできます。その属性が得られなければ、例外 "
":exc:`AttributeError` "
"が送出されます。そうでなければ、生成されるオブジェクトの型と値は、属性を生成したオブジェクトにより決まります。同じ属性参照を複数回評価すると、互いに異なる属性オブジェクトが得られることがあります。"
#: ../../reference/expressions.rst:750
msgid "Subscriptions"
msgstr "添字表記 (subscription)"
#: ../../reference/expressions.rst:763
msgid ""
"A subscription selects an item of a sequence (string, tuple or list) or "
"mapping (dictionary) object:"
msgstr "添字表記は、シーケンス (文字列、タプルまたはリスト) やマップ (辞書) オブジェクトから、要素を一つ選択します:"
#: ../../reference/expressions.rst:769
msgid ""
"The primary must evaluate to an object that supports subscription (lists or "
"dictionaries for example). User-defined objects can support subscription by"
" defining a :meth:`__getitem__` method."
msgstr ""
"プライマリの評価は、添字表記をサポートするオブジェクト (例えばリストや辞書) でなければなりません。ユーザ定義のオブジェクトは、 "
":meth:`__getitem__` メソッドを定義することで添字表記をサポートできます。"
#: ../../reference/expressions.rst:773
msgid ""
"For built-in objects, there are two types of objects that support "
"subscription:"
msgstr "組み込みオブジェクトでは、添字表記をサポートするオブジェクトには 2 種類あります:"
#: ../../reference/expressions.rst:775
msgid ""
"If the primary is a mapping, the expression list must evaluate to an object "
"whose value is one of the keys of the mapping, and the subscription selects "
"the value in the mapping that corresponds to that key. (The expression list"
" is a tuple except if it has exactly one item.)"
msgstr ""
"プライマリがマップであれば、式リストの値評価結果はマップ内のいずれかのキー値に相当するオブジェクトにならなければなりません。添字表記は、そのキーに対応するマップ内の値"
" (value) を選択します。 (式リストの要素が単独である場合を除き、式リストはタプルでなければなりません。)"
#: ../../reference/expressions.rst:780
msgid ""
"If the primary is a sequence, the expression list must evaluate to an "
"integer or a slice (as discussed in the following section)."
msgstr ""
#: ../../reference/expressions.rst:783
msgid ""
"The formal syntax makes no special provision for negative indices in "
"sequences; however, built-in sequences all provide a :meth:`__getitem__` "
"method that interprets negative indices by adding the length of the sequence"
" to the index (so that ``x[-1]`` selects the last item of ``x``). The "
"resulting value must be a nonnegative integer less than the number of items "
"in the sequence, and the subscription selects the item whose index is that "
"value (counting from zero). Since the support for negative indices and "
"slicing occurs in the object's :meth:`__getitem__` method, subclasses "
"overriding this method will need to explicitly add that support."
msgstr ""
"形式的な構文はシーケンスの負のインデックスにいかなる特例も与えません。しかし、すべての組み込みのシーケンスが与える "
":meth:`__getitem__` メソッドは、負のインデックスを、インデックスにシーケンスの長さを加えて解釈します (つまり、 ``x[-1]``"
" は ``x`` の最後の要素を選択します)。結果の値はシーケンスの要素数より小さな非負の整数でなければなりません。添字表記は、(0 から数えた) "
"インデックスを持つ要素を選択します。負のインデックスのサポートは、オブジェクトの :meth:`__getitem__` "
"メソッドに現れるので、このメソッドをオーバーライドするサブクラスは、明示的にこのサポートを追加する必要があります。"
#: ../../reference/expressions.rst:797
msgid ""
"A string's items are characters. A character is not a separate data type "
"but a string of exactly one character."
msgstr "文字列型の要素は文字 (character) です。文字は個別の型ではなく、 1 文字だけからなる文字列です。"
#: ../../reference/expressions.rst:804
msgid "Slicings"
msgstr "スライス表記 (slicing)"
#: ../../reference/expressions.rst:816
msgid ""
"A slicing selects a range of items in a sequence object (e.g., a string, "
"tuple or list). Slicings may be used as expressions or as targets in "
"assignment or :keyword:`del` statements. The syntax for a slicing:"
msgstr ""
"スライス表記はシーケンスオブジェクト (文字列、タプルまたはリスト) におけるある範囲の要素を選択します。スライス表記は式として用いたり、代入や "
":keyword:`del` 文の対象として用いたりできます。スライス表記の構文は以下のようになります:"
#: ../../reference/expressions.rst:829
msgid ""
"There is ambiguity in the formal syntax here: anything that looks like an "
"expression list also looks like a slice list, so any subscription can be "
"interpreted as a slicing. Rather than further complicating the syntax, this"
" is disambiguated by defining that in this case the interpretation as a "
"subscription takes priority over the interpretation as a slicing (this is "
"the case if the slice list contains no proper slice)."
msgstr ""
"上記の形式的な構文法にはあいまいなところがあります: "
"式リストに見えるものは、スライスリストにも見えるため、添字表記はスライス表記としても解釈されうるということです。(スライスリストが適切なスライスを含まない場合)、これ以上の構文の複雑化はせず、スライス表記としての解釈よりも添字表記としての解釈が優先されるように定義することで、あいまいさを取り除いています。"
#: ../../reference/expressions.rst:841
msgid ""
"The semantics for a slicing are as follows. The primary is indexed (using "
"the same :meth:`__getitem__` method as normal subscription) with a key that "
"is constructed from the slice list, as follows. If the slice list contains "
"at least one comma, the key is a tuple containing the conversion of the "