Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8844202

Browse files
author
github-actions
committed
Merge 3.11 into 3.10
1 parent8a7d845 commit8844202

File tree

2 files changed

+82
-11
lines changed

2 files changed

+82
-11
lines changed

‎library/__main__.po‎

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,20 @@ msgid ""
3131
"In Python, the special name ``__main__`` is used for two important "
3232
"constructs:"
3333
msgstr""
34+
"Python では、 ``__main__`` という特別な名前が次の二つの重要な用途で使われま"
35+
"す:"
3436

3537
#:../../library/__main__.rst:12
3638
msgid""
3739
"the name of the top-level environment of the program, which can be checked "
3840
"using the ``__name__ == '__main__'`` expression; and"
3941
msgstr""
42+
"プログラムのトップレベル環境の名前。\n"
43+
"``__name__ == '__main__'`` という式でチェックすることができる。"
4044

4145
#:../../library/__main__.rst:14
4246
msgid"the ``__main__.py`` file in Python packages."
43-
msgstr""
47+
msgstr"Python パッケージにおける ``__main__.py`` ファイル。"
4448

4549
#:../../library/__main__.rst:16
4650
msgid""
@@ -49,6 +53,12 @@ msgid ""
4953
"detail below. If you're new to Python modules, see the tutorial section :"
5054
"ref:`tut-modules` for an introduction."
5155
msgstr""
56+
"どちらも Python のモジュールに関わる機能です。\n"
57+
"1つ目はユーザーがどうモジュールを使うか、2つ目はモジュールとモジュールがど"
58+
"うやりとりするかに関係します。\n"
59+
"詳細は以下で説明します。\n"
60+
"Python モジュールがどういうものかについては、 :ref:`tut-modules` を参照してく"
61+
"ださい。"
5262

5363
#:../../library/__main__.rst:25
5464
msgid"``__name__ == '__main__'``"
@@ -60,22 +70,30 @@ msgid ""
6070
"module's name. Usually, this is the name of the Python file itself without "
6171
"the ``.py`` extension::"
6272
msgstr""
73+
"Python モジュールやパッケージがインポートされるとき、 ``__name__`` の値はその"
74+
"モジュールの名前となります。\n"
75+
"通常、インポートされる Python ファイル自体のファイル名から拡張子``.py`` を除"
76+
"いたものとなります::"
6377

6478
#:../../library/__main__.rst:35
6579
msgid""
6680
"If the file is part of a package, ``__name__`` will also include the parent "
6781
"package's path::"
6882
msgstr""
83+
"インポートされるファイルがパッケージの一部である場合は、 ``__name__`` にはそ"
84+
"のパッケージのパスも含まれます::"
6985

7086
#:../../library/__main__.rst:42
7187
msgid""
7288
"However, if the module is executed in the top-level code environment, its "
7389
"``__name__`` is set to the string ``'__main__'``."
7490
msgstr""
91+
"しかし、モジュールがトップレベルのスクリプト環境で実行される場合は、 "
92+
"``__name__`` が ``'__main__'`` という文字列になります。"
7593

7694
#:../../library/__main__.rst:46
7795
msgid"What is the\"top-level code environment\"?"
78-
msgstr""
96+
msgstr"「トップレベルのスクリプト環境」とは"
7997

8098
#:../../library/__main__.rst:48
8199
msgid""
@@ -88,36 +106,41 @@ msgstr ""
88106

89107
#:../../library/__main__.rst:53
90108
msgid"The top-level code environment can be:"
91-
msgstr""
109+
msgstr"以下のものがトップレベルのスクリプト環境となります:"
92110

93111
#:../../library/__main__.rst:55
94112
msgid"the scope of an interactive prompt::"
95-
msgstr""
113+
msgstr"インタラクティブプロンプトのスコープ::"
96114

97115
#:../../library/__main__.rst:60
98116
msgid"the Python module passed to the Python interpreter as a file argument:"
99-
msgstr""
117+
msgstr"Python インタープリタにファイル引数として渡される Python モジュール:"
100118

101119
#:../../library/__main__.rst:67
102120
msgid""
103121
"the Python module or package passed to the Python interpreter with the :"
104122
"option:`-m` argument:"
105123
msgstr""
124+
"Python インタープリタにPython :option:`-m` オプションとして渡される Python モ"
125+
"ジュールまたはパッケージ:"
106126

107127
#:../../library/__main__.rst:75
108128
msgid"Python code read by the Python interpreter from standard input:"
109-
msgstr""
129+
msgstr"標準入力から Python インタープリタが読み込む Python コード:"
110130

111131
#:../../library/__main__.rst:86
112132
msgid""
113133
"Python code passed to the Python interpreter with the :option:`-c` argument:"
114134
msgstr""
135+
"Python インタープリタに :option:`-c` オプションで渡される Python コード:"
115136

116137
#:../../library/__main__.rst:97
117138
msgid""
118139
"In each of these situations, the top-level module's ``__name__`` is set to "
119140
"``'__main__'``."
120141
msgstr""
142+
"上記それぞれの場合で、トップレベルのモジュールの ``__name__`` の値が "
143+
"``'__main__'`` となります。"
121144

122145
#:../../library/__main__.rst:100
123146
msgid""
@@ -126,16 +149,22 @@ msgid ""
126149
"idiom for conditionally executing code when the module is not initialized "
127150
"from an import statement::"
128151
msgstr""
152+
"これにより、 ``__name__`` をチェックすれば各モジュールは自分がトップレベル環"
153+
"境で実行されているかどうかを知ることができます。\n"
154+
"このことから、モジュールが import 文で初期化された場合以外の場合でのみコード"
155+
"を実行するため、次のコードがしばしば用いられます::"
129156

130157
#:../../library/__main__.rst:111
131158
msgid""
132159
"For a more detailed look at how ``__name__`` is set in all situations, see "
133160
"the tutorial section :ref:`tut-modules`."
134161
msgstr""
162+
"あらゆる場合に ``__name__`` の値がどうセットされるのかについて、詳しくは"
163+
"チュートリアルの :ref:`tut-modules` セクションを参照してください。"
135164

136165
#:../../library/__main__.rst:116../../library/__main__.rst:239
137166
msgid"Idiomatic Usage"
138-
msgstr""
167+
msgstr"通常の使われ方"
139168

140169
#:../../library/__main__.rst:118
141170
msgid""
@@ -144,13 +173,20 @@ msgid ""
144173
"like this was imported from a different module, for example to unit test it, "
145174
"the script code would unintentionally execute as well."
146175
msgstr""
176+
"一部のモジュールでは、コマンドライン引数をパースしたり標準入力からデータを取"
177+
"得したなど、スクリプト用途のみのコードが含まれています。\n"
178+
"このようなモジュールが、例えばユニットテストのため、別のモジュールからイン"
179+
"ポートされると、そのスクリプト用コードが意図に反して実行されてしまいます。"
147180

148181
#:../../library/__main__.rst:123
149182
msgid""
150183
"This is where using the ``if __name__ == '__main__'`` code block comes in "
151184
"handy. Code within this block won't run unless the module is executed in the "
152185
"top-level environment."
153186
msgstr""
187+
"``if __name__ == '__main__'`` というコードは、このようなときに役立ちます。\n"
188+
"このブロックの中にあるコードは、当該のモジュールがトップレベル環境で実行され"
189+
"ていない限り、実行されません。"
154190

155191
#:../../library/__main__.rst:127
156192
msgid""
@@ -168,6 +204,12 @@ msgid ""
168204
"the global variable instead of a local name. A ``main`` function solves "
169205
"this problem."
170206
msgstr""
207+
"注意すべき点として、もし ``main`` 関数内のコードをカプセル化せず ``if "
208+
"__name__ == '__main__'`` の下に直接書いた場合、 ``phrase`` 変数はモジュール全"
209+
"体からグローバルにアクセスできてしまいます。\n"
210+
"モジュール内の他の関数が意図せずローカル変数ではなくそのグローバル変数を使用"
211+
"してしまう可能性があるため、ミスにつながります。\n"
212+
"``main`` 関数を用意することでこの問題は解決できます。"
171213

172214
#:../../library/__main__.rst:158
173215
msgid""
@@ -176,6 +218,11 @@ msgid ""
176218
"imported, the ``echo`` and ``main`` functions will be defined, but neither "
177219
"of them will be called, because ``__name__ != '__main__'``."
178220
msgstr""
221+
"``main`` 関数を使うことのもう一つのメリットとして、 ``echo`` 関数が分離し、別"
222+
"の場所からインポートできるようになることです。\n"
223+
"``echo.py`` がインポートされるとき、 ``echo`` 関数と ``main`` 関数が定義され"
224+
"ますが、 ``__name__ != '__main__'`` であるため、どちらの関数も呼び出されませ"
225+
"ん。"
179226

180227
#:../../library/__main__.rst:165
181228
msgid"Packaging Considerations"

‎reference/compound_stmts.po‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,9 @@ msgid ""
558558
"You can also write multi-item context managers in multiple lines if the "
559559
"items are surrounded by parentheses. For example::"
560560
msgstr""
561+
"括弧で囲むことにより、複数のコンテキストマネージャを複数行に渡って書くことが"
562+
"できます。\n"
563+
"例::"
561564

562565
#:../../reference/compound_stmts.rst:482
563566
msgid"Support for multiple context expressions."
@@ -567,7 +570,7 @@ msgstr "複数のコンテキスト式をサポートしました。"
567570
msgid""
568571
"Support for using grouping parentheses to break the statement in multiple "
569572
"lines."
570-
msgstr""
573+
msgstr"括弧で囲むことで、文を複数行に分割して書けるようになりました。"
571574

572575
#:../../reference/compound_stmts.rst:491
573576
msgid":pep:`343` - The\"with\" statement"
@@ -586,34 +589,44 @@ msgstr ":keyword:`!match` 文"
586589
#:../../reference/compound_stmts.rst:511
587590
msgid"The match statement is used for pattern matching. Syntax:"
588591
msgstr""
592+
"match 文はパターンマッチングを行う目的で使われます。\n"
593+
"構文:"
589594

590595
#:../../reference/compound_stmts.rst:520
591596
msgid""
592597
"This section uses single quotes to denote :ref:`soft keywords <soft-"
593598
"keywords>`."
594599
msgstr""
600+
"このセクションでは、一重引用符で囲まれているものは :ref:`ソフトキーワード "
601+
"<soft-keywords>` を表します。"
595602

596603
#:../../reference/compound_stmts.rst:523
597604
msgid""
598605
"Pattern matching takes a pattern as input (following ``case``) and a subject "
599606
"value (following ``match``). The pattern (which may contain subpatterns) is "
600607
"matched against the subject value. The outcomes are:"
601608
msgstr""
609+
"パターンマッチングは、パターン (``case`` の後ろ) とマッチング対象の値 "
610+
"(``match`` の後ろ)を入力とします。\n"
611+
"パターン (サブパターンを含みうる) は、マッチング対象の値に対して、マッチする"
612+
"かどうかの判定が行われます。結果として次のことが起こります:"
602613

603614
#:../../reference/compound_stmts.rst:527
604615
msgid"A match success or failure (also termed a pattern success or failure)."
605-
msgstr""
616+
msgstr"マッチ成功、もしくはマッチ失敗 (パターン成功・失敗とも呼ばれます)。"
606617

607618
#:../../reference/compound_stmts.rst:529
608619
msgid""
609620
"Possible binding of matched values to a name. The prerequisites for this "
610621
"are further discussed below."
611-
msgstr""
622+
msgstr"マッチした値の名前への束縛。必要な条件は後述します。"
612623

613624
#:../../reference/compound_stmts.rst:532
614625
msgid""
615626
"The ``match`` and ``case`` keywords are :ref:`soft keywords <soft-keywords>`."
616627
msgstr""
628+
"``match`` と ``case`` キーワードは :ref:`ソフトキーワード <soft-keywords>` で"
629+
"す。"
617630

618631
#:../../reference/compound_stmts.rst:536
619632
#:../../reference/compound_stmts.rst:1091
@@ -631,14 +644,17 @@ msgstr "概要"
631644

632645
#:../../reference/compound_stmts.rst:543
633646
msgid"Here's an overview of the logical flow of a match statement:"
634-
msgstr""
647+
msgstr"match 文の論理的な動作の流れの概要は次の通りです:"
635648

636649
#:../../reference/compound_stmts.rst:546
637650
msgid""
638651
"The subject expression ``subject_expr`` is evaluated and a resulting subject "
639652
"value obtained. If the subject expression contains a comma, a tuple is "
640653
"constructed using :ref:`the standard rules <typesseq-tuple>`."
641654
msgstr""
655+
"サブジェクト式 ``subject_expr`` が評価され、サブジェクト値が得られます。\n"
656+
"サブジェクト式がコンマを含む場合、 :ref:`通常のルール <typesseq-tuple>` に"
657+
"従ってタプルが作成されます。"
642658

643659
#:../../reference/compound_stmts.rst:550
644660
msgid""
@@ -649,6 +665,14 @@ msgid ""
649665
"specified below. **Name bindings made during a successful pattern match "
650666
"outlive the executed block and can be used after the match statement**."
651667
msgstr""
668+
"``case_block`` 内の各パターンに対して、サブジェクト値がマッチするかどうかを"
669+
"チェックします。\n"
670+
"マッチ成功・失敗の具体的なルールは後述します。\n"
671+
"マッチングのチェックにより、パターン内の名前の一部あるいはすべてに値が束縛さ"
672+
"れます。\n"
673+
"具体的な束縛ルールはパターンの種類によって異なるため、後述します。 **成功した"
674+
"マッチで束縛された名前は、そのブロックの実行後も存続し、 match 文の後も使用す"
675+
"ることができます**。"
652676

653677
#:../../reference/compound_stmts.rst:559
654678
msgid""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp