@@ -1513,6 +1513,9 @@ msgid ""
15131513"``sys.exc_info()``, and as the ``__traceback__`` attribute of the caught "
15141514"exception."
15151515msgstr ""
1516+ "暗黙的に作成されたトレースバックでは、例外ハンドラの検索が実行スタックを戻っていく際、戻ったレベル毎に、トレースバックオブジェクトが現在のトレースバックの前に挿入されます。\n"
1517+ "例外ハンドラに入ると、スタックトレースをプログラム側で利用できるようになります。(:ref:`try` を参照。)\n"
1518+ "トレースバックは、 ``sys.exc_info()`` が返すタプルの三番目の要素や、捕捉した例外の ``__traceback__`` 属性として得られます。"
15161519
15171520#: ../../reference/datamodel.rst:1033
15181521msgid ""
@@ -1521,13 +1524,17 @@ msgid ""
15211524"interactive, it is also made available to the user as "
15221525"``sys.last_traceback``."
15231526msgstr ""
1527+ "プログラムに適切なハンドラがないとき、スタックトレースは (うまく書式化されて) 標準エラーストリームに書き出されます; "
1528+ "インタプリタが対話的に実行されている場合、 ``sys.last_traceback`` として得ることもできます。"
15241529
15251530#: ../../reference/datamodel.rst:1038
15261531msgid ""
15271532"For explicitly created tracebacks, it is up to the creator of the traceback "
15281533"to determine how the ``tb_next`` attributes should be linked to form a full "
15291534"stack trace."
15301535msgstr ""
1536+ "明示的に作成されたトレースバックでは、 ``tb_next`` "
1537+ "属性がリンクされスタックトレース全体を形成する方法の決定は、トレースバックの作成者に任されます。"
15311538
15321539#: ../../reference/datamodel.rst:1048
15331540msgid ""
@@ -1549,12 +1556,16 @@ msgid ""
15491556"trace (towards the frame where the exception occurred), or ``None`` if there"
15501557" is no next level."
15511558msgstr ""
1559+ "書き込み可能な特殊属性: :attr:`tb_next` はスタックトレースの次のレベル (例外が発生したフレームの方向) "
1560+ "か、あるいは次のレベルが無い場合は ``None`` です。"
15521561
15531562#: ../../reference/datamodel.rst:1064
15541563msgid ""
15551564"Traceback objects can now be explicitly instantiated from Python code, and "
15561565"the ``tb_next`` attribute of existing instances can be updated."
15571566msgstr ""
1567+ "トレースバックオブジェクトは Python コードから明示的にインスタンス化できるようになり、既存のインスタンスの ``tb_next`` "
1568+ "属性は更新できるようになりました。"
15581569
15591570#: ../../reference/datamodel.rst:1092
15601571msgid "Slice objects"
@@ -1823,6 +1834,8 @@ msgid ""
18231834"may already be taken by the code that gets interrupted to execute "
18241835":meth:`__del__`."
18251836msgstr ""
1837+ ":meth:`__del__` は、任意のコードが実行されているときに、任意のスレッドから呼び出せます。\n"
1838+ ":meth:`__del__` で、ロックを取ったり、ブロックするリソースを呼び出したりする必要がある場合、 :meth:`__del__` の実行により中断されたコードにより、そのリソースが既に取得されていて、デッドロックが起きるかもしれません。"
18261839
18271840#: ../../reference/datamodel.rst:1250
18281841msgid ""
@@ -1936,6 +1949,8 @@ msgid ""
19361949"``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than "
19371950"``format(str(self), '')``."
19381951msgstr ""
1952+ "``object.__format__(x, '')`` は ``format(str(self), '')`` ではなく ``str(x)`` "
1953+ "と等価になりました。"
19391954
19401955#: ../../reference/datamodel.rst:1349
19411956msgid ""
@@ -2168,6 +2183,8 @@ msgid ""
21682183":exc:`AttributeError`). This method should either return the (computed) "
21692184"attribute value or raise an :exc:`AttributeError` exception."
21702185msgstr ""
2186+ "デフォルトの属性アクセスが :exc:`AttributeError` で失敗したとき (*name* がインスタンスの属性または ``self`` のクラスツリーの属性でないために :meth:`__getattribute__` が :exc:`AttributeError` を送出したか、 *name* プロパティの :meth:`__get__` が :exc:`AttributeError` を送出したとき) に呼び出されます。\n"
2187+ "このメソッドは (計算された) 属性値を返すか、 :exc:`AttributeError` 例外を送出しなければなりません。"
21712188
21722189#: ../../reference/datamodel.rst:1497
21732190msgid ""
@@ -2267,13 +2284,19 @@ msgid ""
22672284"module ``__dict__`` before raising an :exc:`AttributeError`. If found, it is"
22682285" called with the attribute name and the result is returned."
22692286msgstr ""
2287+ "特殊な名前の ``__getattr__`` と ``__dir__`` も、モジュール属性へのアクセスをカスタマイズするのに使えます。\n"
2288+ "モジュールレベルの ``__getattr__`` 関数は属性名である 1 引数を受け取り、計算した値を返すか :exc:`AttributeError` を送出します。\n"
2289+ "属性がモジュールオブジェクトから、通常の検索、つまり :meth:`object.__getattribute__` で見付からなかった場合は、 :exc:`AttributeError` を送出する前に、モジュールの ``__dict__`` から ``__getattr__`` が検索されます。\n"
2290+ "見付かった場合は、その属性名で呼び出され、結果が返されます。"
22702291
22712292#: ../../reference/datamodel.rst:1566
22722293msgid ""
22732294"The ``__dir__`` function should accept no arguments, and return a list of "
22742295"strings that represents the names accessible on module. If present, this "
22752296"function overrides the standard :func:`dir` search on a module."
22762297msgstr ""
2298+ "``__dir__`` 関数は引数を受け取らず、モジュールのアクセス可能な名前を表す文字列のリストを返さなければなりません。\n"
2299+ "存在する場合は、この関数はモジュールの標準の :func:`dir` 検索を上書きします。"
22772300
22782301#: ../../reference/datamodel.rst:1570
22792302msgid ""
@@ -2336,27 +2359,29 @@ msgid ""
23362359"*owner*. This method should return the (computed) attribute value or raise "
23372360"an :exc:`AttributeError` exception."
23382361msgstr ""
2339- "オーナクラスの属性を取得する (クラス属性へのアクセス) 際や、オーナクラスのインスタンスの属性を取得する (インスタンス属性へのアクセス) "
2340- "場合に呼び出されます。 *owner* は常にオーナクラスです 。一方、 *instance* は属性へのアクセスを仲介するインスタンスか属性が "
2362+ "オーナークラスの属性を取得する (クラス属性へのアクセス) 際や、オーナークラスのインスタンスの属性を取得する (インスタンス属性へのアクセス) "
2363+ "場合に呼び出されます。 *owner* は常にオーナークラスです 。一方、 *instance* は属性へのアクセスを仲介するインスタンスか属性が "
23412364"*owner* を介してアクセスされる場合は ``None`` になります。このメソッドは (計算された) 属性値を返すか、 "
23422365":exc:`AttributeError` 例外を送出しなければなりません。"
23432366
23442367#: ../../reference/datamodel.rst:1630
23452368msgid ""
23462369"Called to set the attribute on an instance *instance* of the owner class to "
23472370"a new value, *value*."
2348- msgstr "オーナクラスのインスタンス *instance* 上の属性を新たな値 *value* に設定する際に呼び出されます。"
2371+ msgstr "オーナークラスのインスタンス *instance* 上の属性を新たな値 *value* に設定する際に呼び出されます。"
23492372
23502373#: ../../reference/datamodel.rst:1636
23512374msgid ""
23522375"Called to delete the attribute on an instance *instance* of the owner class."
2353- msgstr "オーナクラスのインスタンス *instance* 上の属性を削除する際に呼び出されます。"
2376+ msgstr "オーナークラスのインスタンス *instance* 上の属性を削除する際に呼び出されます。"
23542377
23552378#: ../../reference/datamodel.rst:1641
23562379msgid ""
23572380"Called at the time the owning class *owner* is created. The descriptor has "
23582381"been assigned to *name*."
23592382msgstr ""
2383+ "オーナーとなるクラス *owner* が作成された時点で呼び出されます。\n"
2384+ "ディスクリプタは *name* に割り当てられます。"
23602385
23612386#: ../../reference/datamodel.rst:1647
23622387msgid ""
@@ -2519,12 +2544,16 @@ msgid ""
25192544"and deny the creation of *__dict__* and *__weakref__* (unless explicitly "
25202545"declared in *__slots__* or available in a parent.)"
25212546msgstr ""
2547+ "*__slots__* を使うと、(プロパティのように) データメンバを明示的に宣言し、 (明示的に *__slots__* "
2548+ "で宣言しているか親クラスに存在しているかでない限り) *__dict__* や *__weakref__* を作成しないようにできます。"
25222549
25232550#: ../../reference/datamodel.rst:1727
25242551msgid ""
25252552"The space saved over using *__dict__* can be significant. Attribute lookup "
25262553"speed can be significantly improved as well."
25272554msgstr ""
2555+ "*__dict__* を使うのに比べて、節約できるメモリ空間はかなり大きいです。\n"
2556+ "属性探索のスピードもかなり向上できます。"
25282557
25292558#: ../../reference/datamodel.rst:1732
25302559msgid ""
@@ -2546,6 +2575,8 @@ msgid ""
25462575"When inheriting from a class without *__slots__*, the *__dict__* and "
25472576"*__weakref__* attribute of the instances will always be accessible."
25482577msgstr ""
2578+ "*__slots__* を持たないクラスから継承するとき、インスタンスの *__dict__* 属性と *__weakref__* "
2579+ "属性は常に利用可能です。"
25492580
25502581#: ../../reference/datamodel.rst:1744
25512582msgid ""
@@ -2591,6 +2622,9 @@ msgid ""
25912622"unless they also define *__slots__* (which should only contain names of any "
25922623"*additional* slots)."
25932624msgstr ""
2625+ "*__slots__* の宣言の作用は、それが定義されたクラスだけには留まりません。\n"
2626+ "親クラスで宣言された *__slots__* は子クラスでも利用可能です。\n"
2627+ "ただし、子クラスは、自身も *__slots__* (ここには *追加の* スロットの名前のみ含めるべき) を定義しない限り*__dict__* や *__weakref__* を持ちます。"
25942628
25952629#: ../../reference/datamodel.rst:1767
25962630msgid ""
0 commit comments