@@ -15,7 +15,7 @@ msgid ""
1515msgstr ""
1616"Project-Id-Version : Python 3.12\n "
1717"Report-Msgid-Bugs-To : \n "
18- "POT-Creation-Date : 2023-09-08 14:13+0000\n "
18+ "POT-Creation-Date : 2023-09-15 14:13+0000\n "
1919"PO-Revision-Date : 2021-06-28 00:52+0000\n "
2020"Last-Translator : Arihiro TAKASE, 2023\n "
2121"Language-Team : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
@@ -255,6 +255,13 @@ msgid ""
255255"derived class method wants to extend the base class method of the same name "
256256"and thus has to call the base class method somehow."
257257msgstr ""
258+ "第二に、特定のクラスからメソッドを明示的に参照または呼び出ししたい時に、特別"
259+ "な構文が必要なくなります。C++ では、派生クラスでオーバーライドされた基底クラ"
260+ "スからメソッドを使うには、 ``::`` 演算子を使わなければなりません。 -- Python "
261+ "では、 ``baseclass.methodname(self, <argument list>)`` と書けます。これは特"
262+ "に、 :meth:`~object.__init__` メソッドに便利ですし、派生クラスのメソッドが、"
263+ "基底クラスにある同じ名前のメソッドを拡張するために、基底クラスのメソッドをど"
264+ "うにかして呼び出したい時にも便利です。"
258265
259266#: ../../faq/design.rst:136
260267msgid ""
@@ -437,6 +444,9 @@ msgid ""
437444"exceptions are raised. Actually catching an exception is expensive. In "
438445"versions of Python prior to 2.0 it was common to use this idiom::"
439446msgstr ""
447+ ":keyword:`try`/:keyword:`except` ブロックは例外が送出されなければ極端に効率的"
448+ "です。実際に例外を捕捉するのは高価です。Python 2.0 より前のバージョンでは、こ"
449+ "のイディオムを使うのが一般的でした::"
440450
441451#: ../../faq/design.rst:246
442452msgid ""
@@ -625,6 +635,10 @@ msgid ""
625635"however, those file objects will only get collected (and closed) at varying "
626636"and possibly long intervals."
627637msgstr ""
638+ "実際、CPython の参照カウントとデストラクタのスキームを使えば ``f`` への新しい"
639+ "代入ごとにファイルは閉じられます。しかし、伝統的な GC を使うと、これらのファ"
640+ "イルオブジェクトが回収され (て閉じられる) までに不定な、場合によっては長い、"
641+ "間隔が空くことがあります。"
628642
629643#: ../../faq/design.rst:360
630644msgid ""
@@ -664,6 +678,12 @@ msgid ""
664678"Right now, CPython works with anything that implements ``malloc()`` and "
665679"``free()`` properly."
666680msgstr ""
681+ "伝統的な GC は Python が他のアプリケーションに組み込まれるときにも問題となり"
682+ "ます。スタンドアロンの Python で動く限りでは、標準の ``malloc()`` と "
683+ "``free()`` を GC ライブラリから提供されるものに置き換えても問題ありませんが、"
684+ "Python を実装したアプリケーションは Python のものではない *独自の* 代替品を使"
685+ "おうとするかもしれません。現在のようにすることで、CPython は ``malloc()`` と "
686+ "``free()`` が適切に実装されている限りどんなものにも対応させられます。"
667687
668688#: ../../faq/design.rst:387
669689msgid "Why isn't all memory freed when CPython exits?"
@@ -707,6 +727,11 @@ msgid ""
707727"example, a Cartesian coordinate is appropriately represented as a tuple of "
708728"two or three numbers."
709729msgstr ""
730+ "リストとタプルは、多くの点で似ていますが、一般には本質的に異なる方法で使われ"
731+ "ます。タプルは、Pascal の ``レコード`` や C の ``構造体`` と同様なものと考え"
732+ "られます。型が異なっても良い関連するデータの小さな集合で、グループとして演算"
733+ "されます。例えば、デカルト座標は 2 つや 3 つの数のタプルとして適切に表せま"
734+ "す。"
710735
711736#: ../../faq/design.rst:410
712737msgid ""
@@ -717,6 +742,11 @@ msgid ""
717742"directory. Functions which operate on this output would generally not break "
718743"if you added another file or two to the directory."
719744msgstr ""
745+ "一方、リストは、もっと他の言語の配列に近いものです。全て同じ型の可変数のオブ"
746+ "ジェクトを持ち、それらが一つ一つ演算される傾向にあります。例えば、 :func:`os."
747+ "listdir('.') <os.listdir>` はカレントディレクトリ内にあるファイルの文字列表現"
748+ "のリストを返します。この出力を演算する関数は一般に、ディレクトリに一つや二つ"
749+ "の別のファイルを加えても壊れません。"
720750
721751#: ../../faq/design.rst:418
722752msgid ""
@@ -793,6 +823,14 @@ msgid ""
793823"values, this means that dictionaries take constant time -- O(1), in Big-O "
794824"notation -- to retrieve a key."
795825msgstr ""
826+ "辞書は、 辞書に保存されているそれぞれのキーに対応するハッシュコードを :func:"
827+ "`hash` ビルトイン関数で計算することで機能します。このハッシュコードはキーやプ"
828+ "ロセスごとのシードによって大きく変化します。例えば、``'Python'`` のハッシュ値"
829+ "は ``-539294296`` ですが、ビットが一つ違うだけの文字列 ``'python'`` のハッ"
830+ "シュ値は ``1142331976`` です。そしてこのハッシュコードは、値が保存される内部"
831+ "配列での位置を計算するために使われます。保存しているキーのハッシュ値が全て異"
832+ "なるとすれば、一定の時間 − big O-記法ではO(1) − でキーを検索できることになり"
833+ "ます。"
796834
797835#: ../../faq/design.rst:458
798836msgid "Why must dictionary keys be immutable?"
@@ -899,6 +937,12 @@ msgid ""
899937"reside in a dictionary (or other hash based structure), remain fixed while "
900938"the object is in the dictionary (or other structure). ::"
901939msgstr ""
940+ "必要ならばこれを回避する方法がありますが、自己責任のもとで行ってください。"
941+ "ミュータブルな構造を、 :meth:`~object.__eq__` と :meth:`~object.__hash__` メ"
942+ "ソッドの両方を持つクラスインスタンスに含めることができます。その時、辞書 (ま"
943+ "たはハッシュに基づく別の構造体) に属するような全てのラッパーオブジェクトの"
944+ "ハッシュ値が、そのオブジェクトが辞書 (その他の構造体) 中にある間固定され続け"
945+ "ることを確実にしてください。 ::"
902946
903947#: ../../faq/design.rst:525
904948msgid ""
@@ -929,6 +973,10 @@ msgid ""
929973"this unless you are prepared to think hard about the requirements and the "
930974"consequences of not meeting them correctly. Consider yourself warned."
931975msgstr ""
976+ "この :class:`!ListWrapper` の例では、異常を避けるため、ラッパオブジェクトが辞"
977+ "書内にある限りラップされたリストが変更されてはなりません。この条件と満たせな"
978+ "かった時の結果について知恵を絞る覚悟がない限り、これをしてはいけません。よく"
979+ "考えてください。"
932980
933981#: ../../faq/design.rst:541
934982msgid "Why doesn't list.sort() return the sorted list?"
@@ -1029,6 +1077,12 @@ msgid ""
10291077"actually do this correctly, but it's trivial to check this property in a "
10301078"test suite."
10311079msgstr ""
1080+ "Python で大きくて複雑なアプリケーションを構築するとき、インターフェース仕様と"
1081+ "同様に、適切なテスト規律も役立ちます。実際には、インターフェース仕様ではテス"
1082+ "トできないプログラムの属性もあるので、それ以上にもなりえます。例えば、 :meth:"
1083+ "`!list.append` メソッドは新しい要素をある内部リストの終わりに加えます。イン"
1084+ "ターフェース仕様ではこの :meth:`!list.append` の実装が実際にこれを行うかをテ"
1085+ "ストできませんが、テストスイートならこの機能を簡単に確かめられます。"
10321086
10331087#: ../../faq/design.rst:592
10341088msgid ""
@@ -1058,6 +1112,13 @@ msgid ""
10581112"`while` and :keyword:`for` statements, possibly containing :keyword:"
10591113"`continue` and :keyword:`break`)."
10601114msgstr ""
1115+ "1970年代、人々は気付きました。秩序なき goto は、理解するのも手直しするのも困"
1116+ "難という厄介な\" スパゲッティ\" コードに陥りがちであると。\n"
1117+ "高水準言語では、分岐とループの手段があれば goto は不要です。\n"
1118+ "(Pythonだと、分岐には :keyword:`if` 文及び :keyword:`or` ・ :keyword:`and` "
1119+ "・ :keyword:`if`/:keyword:`else` 式を使います。ループには :keyword:`while` 文"
1120+ "と :keyword:`for` 文を使い、 ループ内に :keyword:`continue` ・ :keyword:"
1121+ "`break` を含むことがあります)"
10611122
10621123#: ../../faq/design.rst:609
10631124msgid ""
@@ -1066,12 +1127,18 @@ msgid ""
10661127"all reasonable uses of the ``go`` or ``goto`` constructs of C, Fortran, and "
10671128"other languages. For example::"
10681129msgstr ""
1130+ "関数の呼び出しをまたいでも動作する \" 構造化された goto\" をまかなうものとして"
1131+ "例外を使えます。C、Fortran、その他の言語での ``go`` あるいは ``goto`` 構造の"
1132+ "適切な用途は全て、例外で同じようなことをすれば便利であると、広く感じられてい"
1133+ "ます。例えば::"
10691134
10701135#: ../../faq/design.rst:625
10711136msgid ""
10721137"This doesn't allow you to jump into the middle of a loop, but that's usually "
10731138"considered an abuse of ``goto`` anyway. Use sparingly."
10741139msgstr ""
1140+ "例外ではループ内へ跳ぶことはできませんが、どちらにしてもそれは ``goto`` の乱"
1141+ "用と見なされるものです。使うのは控えてください。"
10751142
10761143#: ../../faq/design.rst:630
10771144msgid "Why can't raw strings (r-strings) end with a backslash?"
@@ -1129,6 +1196,9 @@ msgid ""
11291196"calling code on the entrance and exit from the block. Some languages have a "
11301197"construct that looks like this::"
11311198msgstr ""
1199+ "Python には、ブロックの実行を包む :keyword:`with` 文があり、ブロックに入ると"
1200+ "きとブロックから出るときに、コードを呼び出します。以下のような構造を持つ言語"
1201+ "があります::"
11321202
11331203#: ../../faq/design.rst:666
11341204msgid "In Python, such a construct would be ambiguous."
@@ -1170,13 +1240,21 @@ msgid ""
11701240"variable named ``x``, will it be used inside the :keyword:`with` block? As "
11711241"you see, the dynamic nature of Python makes such choices much harder."
11721242msgstr ""
1243+ "このコード片では、``a`` は ``x``. というメンバ属性を持っていると仮定されてい"
1244+ "ます。しかし、Python ではインタプリタにはこの仮定を伝えられる仕組みはありませ"
1245+ "ん。 ``a`` が、例えば整数だったら、どうなってしまうでしょうか。 ``x`` という"
1246+ "名前のグローバル変数があったら、それが :keyword:`with` ブロックの中で使われる"
1247+ "のでしょうか。この通り、Python の動的な特質から、このような選択はとても難しい"
1248+ "物になっています。"
11731249
11741250#: ../../faq/design.rst:691
11751251msgid ""
11761252"The primary benefit of :keyword:`with` and similar language features "
11771253"(reduction of code volume) can, however, easily be achieved in Python by "
11781254"assignment. Instead of::"
11791255msgstr ""
1256+ "しかし、:keyword:`with` やそれに類する言語の機能の一番の利点 (コード量の削"
1257+ "減) は、 Python では代入により簡単に手に入れられます::"
11801258
11811259#: ../../faq/design.rst:698
11821260msgid "write this::"
0 commit comments