@@ -22,7 +22,7 @@ msgid ""
2222msgstr ""
2323"Project-Id-Version : Python 3.9\n "
2424"Report-Msgid-Bugs-To : \n "
25- "POT-Creation-Date : 2021-01-01 05:02 +0000\n "
25+ "POT-Creation-Date : 2021-04-04 05:56 +0000\n "
2626"PO-Revision-Date : 2017-02-16 17:43+0000\n "
2727"Last-Translator : mollinaca, 2020\n "
2828"Language-Team : Japanese (https://www.transifex.com/python-doc/teams/5390/ja/)\n "
@@ -2172,14 +2172,106 @@ msgstr ""
21722172"を調べたいオブジェクトがまだ生きてることを保証したいなら、オブジェクトへの別の参照を作ってください:"
21732173
21742174#: ../../faq/programming.rst:1706
2175+ msgid "When can I rely on identity tests with the *is* operator?"
2176+ msgstr ""
2177+
2178+ #: ../../faq/programming.rst:1708
2179+ msgid ""
2180+ "The ``is`` operator tests for object identity. The test ``a is b`` is "
2181+ "equivalent to ``id(a) == id(b)``."
2182+ msgstr ""
2183+
2184+ #: ../../faq/programming.rst:1711
2185+ msgid ""
2186+ "The most important property of an identity test is that an object is always "
2187+ "identical to itself, ``a is a`` always returns ``True``. Identity tests are"
2188+ " usually faster than equality tests. And unlike equality tests, identity "
2189+ "tests are guaranteed to return a boolean ``True`` or ``False``."
2190+ msgstr ""
2191+
2192+ #: ../../faq/programming.rst:1716
2193+ msgid ""
2194+ "However, identity tests can *only* be substituted for equality tests when "
2195+ "object identity is assured. Generally, there are three circumstances where "
2196+ "identity is guaranteed:"
2197+ msgstr ""
2198+
2199+ #: ../../faq/programming.rst:1720
2200+ msgid ""
2201+ "1) Assignments create new names but do not change object identity. After "
2202+ "the assignment ``new = old``, it is guaranteed that ``new is old``."
2203+ msgstr ""
2204+
2205+ #: ../../faq/programming.rst:1723
2206+ msgid ""
2207+ "2) Putting an object in a container that stores object references does not "
2208+ "change object identity. After the list assignment ``s[0] = x``, it is "
2209+ "guaranteed that ``s[0] is x``."
2210+ msgstr ""
2211+
2212+ #: ../../faq/programming.rst:1727
2213+ msgid ""
2214+ "3) If an object is a singleton, it means that only one instance of that "
2215+ "object can exist. After the assignments ``a = None`` and ``b = None``, it "
2216+ "is guaranteed that ``a is b`` because ``None`` is a singleton."
2217+ msgstr ""
2218+
2219+ #: ../../faq/programming.rst:1731
2220+ msgid ""
2221+ "In most other circumstances, identity tests are inadvisable and equality "
2222+ "tests are preferred. In particular, identity tests should not be used to "
2223+ "check constants such as :class:`int` and :class:`str` which aren't "
2224+ "guaranteed to be singletons::"
2225+ msgstr ""
2226+
2227+ #: ../../faq/programming.rst:1748
2228+ msgid "Likewise, new instances of mutable containers are never identical::"
2229+ msgstr ""
2230+
2231+ #: ../../faq/programming.rst:1755
2232+ msgid ""
2233+ "In the standard library code, you will see several common patterns for "
2234+ "correctly using identity tests:"
2235+ msgstr ""
2236+
2237+ #: ../../faq/programming.rst:1758
2238+ msgid ""
2239+ "1) As recommended by :pep:`8`, an identity test is the preferred way to "
2240+ "check for ``None``. This reads like plain English in code and avoids "
2241+ "confusion with other objects that may have boolean values that evaluate to "
2242+ "false."
2243+ msgstr ""
2244+
2245+ #: ../../faq/programming.rst:1762
2246+ msgid ""
2247+ "2) Detecting optional arguments can be tricky when ``None`` is a valid input"
2248+ " value. In those situations, you can create an singleton sentinel object "
2249+ "guaranteed to be distinct from other objects. For example, here is how to "
2250+ "implement a method that behaves like :meth:`dict.pop`::"
2251+ msgstr ""
2252+
2253+ #: ../../faq/programming.rst:1778
2254+ msgid ""
2255+ "3) Container implementations sometimes need to augment equality tests with "
2256+ "identity tests. This prevents the code from being confused by objects such "
2257+ "as ``float('NaN')`` that are not equal to themselves."
2258+ msgstr ""
2259+
2260+ #: ../../faq/programming.rst:1782
2261+ msgid ""
2262+ "For example, here is the implementation of "
2263+ ":meth:`collections.abc.Sequence.__contains__`::"
2264+ msgstr ""
2265+
2266+ #: ../../faq/programming.rst:1793
21752267msgid "Modules"
21762268msgstr "モジュール (module)"
21772269
2178- #: ../../faq/programming.rst:1709
2270+ #: ../../faq/programming.rst:1796
21792271msgid "How do I create a .pyc file?"
21802272msgstr ".pyc ファイルを作るにはどうしますか?"
21812273
2182- #: ../../faq/programming.rst:1711
2274+ #: ../../faq/programming.rst:1798
21832275msgid ""
21842276"When a module is imported for the first time (or when the source file has "
21852277"changed since the current compiled file was created) a ``.pyc`` file "
@@ -2196,7 +2288,7 @@ msgstr ""
21962288" で終わり、中間部分はこのファイルを作った ``python`` バイナリに依存した文字列になります。 (詳細は :pep:`3147` "
21972289"を参照してください。)"
21982290
2199- #: ../../faq/programming.rst:1719
2291+ #: ../../faq/programming.rst:1806
22002292msgid ""
22012293"One reason that a ``.pyc`` file may not be created is a permissions problem "
22022294"with the directory containing the source file, meaning that the "
@@ -2207,7 +2299,7 @@ msgstr ""
22072299"``.pyc`` が作られない理由の 1 つは、ソースファイルがあるディレクトリの権限の問題、つまり ``__pycache__`` "
22082300"サブディレクトリが作れない問題です。これは、例えば、ウェブサーバーでテストを行っているときのような、開発者のユーザと実行者のユーザが別な場合に、起こり得ます。"
22092301
2210- #: ../../faq/programming.rst:1724
2302+ #: ../../faq/programming.rst:1811
22112303msgid ""
22122304"Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, "
22132305"creation of a .pyc file is automatic if you're importing a module and Python"
@@ -2219,7 +2311,7 @@ msgstr ""
22192311"``__pycache__`` サブディレクトリを作り、そこにコンパイルされたモジュールが置ける能力 (権限、ディスクの空きスペース、など) "
22202312"がある場合は、 .pyc ファイルは自動的に作られます。"
22212313
2222- #: ../../faq/programming.rst:1729
2314+ #: ../../faq/programming.rst:1816
22232315msgid ""
22242316"Running Python on a top level script is not considered an import and no "
22252317"``.pyc`` will be created. For example, if you have a top-level module "
@@ -2233,7 +2325,7 @@ msgstr ""
22332325"と打ち込んで) ``foo`` を実行すると、``xyz`` はインポートされるので ``xyz`` の ``.pyc`` "
22342326"は作成されますが、``foo.py`` はインポートされたわけではないので ``foo`` の ``.pyc`` は作られません。"
22352327
2236- #: ../../faq/programming.rst:1736
2328+ #: ../../faq/programming.rst:1823
22372329msgid ""
22382330"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a "
22392331"``.pyc`` file for a module that is not imported -- you can, using the "
@@ -2242,15 +2334,15 @@ msgstr ""
22422334"``foo`` の ``.pyc`` ファイルを作成する -- つまり、インポートされていないモジュールの ``.pyc`` ファイルを作成する -- "
22432335"必要がある場合、 :mod:`py_compile` モジュールと :mod:`compileall` モジュールを使えば可能です。"
22442336
2245- #: ../../faq/programming.rst:1740
2337+ #: ../../faq/programming.rst:1827
22462338msgid ""
22472339"The :mod:`py_compile` module can manually compile any module. One way is to"
22482340" use the ``compile()`` function in that module interactively::"
22492341msgstr ""
22502342":mod:`py_compile` モジュールは手動で任意のモジュールをコンパイルできます。やり方の一つは、このモジュールの ``compile()``"
22512343" 関数をインタラクティブに実行することです::"
22522344
2253- #: ../../faq/programming.rst:1746
2345+ #: ../../faq/programming.rst:1833
22542346msgid ""
22552347"This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same "
22562348"location as ``foo.py`` (or you can override that with the optional parameter"
@@ -2259,7 +2351,7 @@ msgstr ""
22592351"このように実行すると、``foo.py`` と同じ場所の ``__pycache__`` サブディレクトリに ``.pyc`` が書き出されます "
22602352"(出力ファイルの位置は、オプション引数 ``cfile`` で上書きすることもできます)。"
22612353
2262- #: ../../faq/programming.rst:1750
2354+ #: ../../faq/programming.rst:1837
22632355msgid ""
22642356"You can also automatically compile all files in a directory or directories "
22652357"using the :mod:`compileall` module. You can do it from the shell prompt by "
@@ -2269,11 +2361,11 @@ msgstr ""
22692361":mod:`compileall` モジュールを使えば自動的に一つや複数のディレクトリのすべてのファイルをコンパイルできます。シェルプロンプトから "
22702362"``compileall.py`` を起動して、コンパイルしたいファイルを含むディレクトリのパスを指定してください::"
22712363
2272- #: ../../faq/programming.rst:1759
2364+ #: ../../faq/programming.rst:1846
22732365msgid "How do I find the current module name?"
22742366msgstr "現在のモジュール名を知るにはどうしますか?"
22752367
2276- #: ../../faq/programming.rst:1761
2368+ #: ../../faq/programming.rst:1848
22772369msgid ""
22782370"A module can find out its own module name by looking at the predefined "
22792371"global variable ``__name__``. If this has the value ``'__main__'``, the "
@@ -2286,78 +2378,78 @@ msgstr ""
22862378"であるとき、そのプログラムはスクリプトとして実行されています。インポートされることによって使われる大抵のモジュールはコマンドラインインターフェースや自己テストも提供していて、``__name__``"
22872379" をチェックしてからそのコードだけを実行します::"
22882380
2289- #: ../../faq/programming.rst:1776
2381+ #: ../../faq/programming.rst:1863
22902382msgid "How can I have modules that mutually import each other?"
22912383msgstr "相互にインポートしあうモジュールを作るにはどうしたらいいですか?"
22922384
2293- #: ../../faq/programming.rst:1778
2385+ #: ../../faq/programming.rst:1865
22942386msgid "Suppose you have the following modules:"
22952387msgstr "以下のモジュールがあったとしましょう:"
22962388
2297- #: ../../faq/programming.rst:1780
2389+ #: ../../faq/programming.rst:1867
22982390msgid "foo.py::"
22992391msgstr "foo.py::"
23002392
2301- #: ../../faq/programming.rst:1785
2393+ #: ../../faq/programming.rst:1872
23022394msgid "bar.py::"
23032395msgstr "bar.py::"
23042396
2305- #: ../../faq/programming.rst:1790
2397+ #: ../../faq/programming.rst:1877
23062398msgid "The problem is that the interpreter will perform the following steps:"
23072399msgstr "問題はインタプリタが以下の段階を実行することです:"
23082400
2309- #: ../../faq/programming.rst:1792
2401+ #: ../../faq/programming.rst:1879
23102402msgid "main imports foo"
23112403msgstr "main が foo をインポートする"
23122404
2313- #: ../../faq/programming.rst:1793
2405+ #: ../../faq/programming.rst:1880
23142406msgid "Empty globals for foo are created"
23152407msgstr "foo の空のグローバルが生成される"
23162408
2317- #: ../../faq/programming.rst:1794
2409+ #: ../../faq/programming.rst:1881
23182410msgid "foo is compiled and starts executing"
23192411msgstr "foo がコンパイルされ実行を始める"
23202412
2321- #: ../../faq/programming.rst:1795
2413+ #: ../../faq/programming.rst:1882
23222414msgid "foo imports bar"
23232415msgstr "foo が bar をインポートする"
23242416
2325- #: ../../faq/programming.rst:1796
2417+ #: ../../faq/programming.rst:1883
23262418msgid "Empty globals for bar are created"
23272419msgstr "bar の空のグローバルが生成される"
23282420
2329- #: ../../faq/programming.rst:1797
2421+ #: ../../faq/programming.rst:1884
23302422msgid "bar is compiled and starts executing"
23312423msgstr "bar がコンパイルされ実行を始める"
23322424
2333- #: ../../faq/programming.rst:1798
2425+ #: ../../faq/programming.rst:1885
23342426msgid ""
23352427"bar imports foo (which is a no-op since there already is a module named foo)"
23362428msgstr "bar が foo をインポートする(すでに foo という名前のモジュールがあるので no-op となる)"
23372429
2338- #: ../../faq/programming.rst:1799
2430+ #: ../../faq/programming.rst:1886
23392431msgid "bar.foo_var = foo.foo_var"
23402432msgstr "bar.foo_var = foo.foo_var"
23412433
2342- #: ../../faq/programming.rst:1801
2434+ #: ../../faq/programming.rst:1888
23432435msgid ""
23442436"The last step fails, because Python isn't done with interpreting ``foo`` yet"
23452437" and the global symbol dictionary for ``foo`` is still empty."
23462438msgstr ""
23472439"この最後の段階は失敗します。Python が ``foo`` を解釈し終わっていなくて、``foo`` のグローバルなシンボルの辞書はまだ空ですから。"
23482440
2349- #: ../../faq/programming.rst:1804
2441+ #: ../../faq/programming.rst:1891
23502442msgid ""
23512443"The same thing happens when you use ``import foo``, and then try to access "
23522444"``foo.foo_var`` in global code."
23532445msgstr ""
23542446"``import foo`` を使って、グローバルコードの ``foo.foo_var`` にアクセスしようとしたときにも、これと同じことが起こります。"
23552447
2356- #: ../../faq/programming.rst:1807
2448+ #: ../../faq/programming.rst:1894
23572449msgid "There are (at least) three possible workarounds for this problem."
23582450msgstr "この問題には (少なくとも) 三つの解決策があります。"
23592451
2360- #: ../../faq/programming.rst:1809
2452+ #: ../../faq/programming.rst:1896
23612453msgid ""
23622454"Guido van Rossum recommends avoiding all uses of ``from <module> import "
23632455"...``, and placing all code inside functions. Initializations of global "
@@ -2369,61 +2461,61 @@ msgstr ""
23692461"を全く使わないで、すべてのコードを関数の中に入れることを勧めています。グローバル変数とクラス変数の初期化は定数とビルトイン関数のみで行われるべきです。これでインポートされたすべてのモジュールは"
23702462" ``<module>.<name>`` として参照されることになります。"
23712463
2372- #: ../../faq/programming.rst:1814
2464+ #: ../../faq/programming.rst:1901
23732465msgid ""
23742466"Jim Roskind suggests performing steps in the following order in each module:"
23752467msgstr "Jim Roskind はそれぞれのモジュールに対して以下の順に進めることを提案しています:"
23762468
2377- #: ../../faq/programming.rst:1816
2469+ #: ../../faq/programming.rst:1903
23782470msgid ""
23792471"exports (globals, functions, and classes that don't need imported base "
23802472"classes)"
23812473msgstr "エクスポート (インポートされた基底クラスを必要としないグローバル、関数、クラス)"
23822474
2383- #: ../../faq/programming.rst:1818
2475+ #: ../../faq/programming.rst:1905
23842476msgid "``import`` statements"
23852477msgstr "``import`` 文"
23862478
2387- #: ../../faq/programming.rst:1819
2479+ #: ../../faq/programming.rst:1906
23882480msgid ""
23892481"active code (including globals that are initialized from imported values)."
23902482msgstr "アクティブなコード (インポートされた値によって初期化されるグローバルを含む)。"
23912483
2392- #: ../../faq/programming.rst:1821
2484+ #: ../../faq/programming.rst:1908
23932485msgid ""
23942486"van Rossum doesn't like this approach much because the imports appear in a "
23952487"strange place, but it does work."
23962488msgstr "インポートが奇妙な場所に現れることから van Rossum はこの方法をそれほど好みませんが、これは有効です。"
23972489
2398- #: ../../faq/programming.rst:1824
2490+ #: ../../faq/programming.rst:1911
23992491msgid ""
24002492"Matthias Urlichs recommends restructuring your code so that the recursive "
24012493"import is not necessary in the first place."
24022494msgstr "Matthias Urlichs は第一に再帰インポートが必要ないようにコードを構築しなおすことを推奨しています。"
24032495
2404- #: ../../faq/programming.rst:1827
2496+ #: ../../faq/programming.rst:1914
24052497msgid "These solutions are not mutually exclusive."
24062498msgstr "これらの解決策はそれぞれ両立させることもできます。"
24072499
2408- #: ../../faq/programming.rst:1831
2500+ #: ../../faq/programming.rst:1918
24092501msgid "__import__('x.y.z') returns <module 'x'>; how do I get z?"
24102502msgstr "__import__('x.y.z') は <module 'x'> を返しますが、z を得るためにはどうしますか?"
24112503
2412- #: ../../faq/programming.rst:1833
2504+ #: ../../faq/programming.rst:1920
24132505msgid ""
24142506"Consider using the convenience function :func:`~importlib.import_module` "
24152507"from :mod:`importlib` instead::"
24162508msgstr ""
24172509":mod:`importlib` に :func:`~importlib.import_module` "
24182510"という便利な関数があるので、代わりにそちらを使用することを検討してください。"
24192511
2420- #: ../../faq/programming.rst:1840
2512+ #: ../../faq/programming.rst:1927
24212513msgid ""
24222514"When I edit an imported module and reimport it, the changes don't show up. "
24232515"Why does this happen?"
24242516msgstr "インポートされたモジュールを編集してから再インポートしましたが、変化が現れません。なぜですか?"
24252517
2426- #: ../../faq/programming.rst:1842
2518+ #: ../../faq/programming.rst:1929
24272519msgid ""
24282520"For reasons of efficiency as well as consistency, Python only reads the "
24292521"module file on the first time a module is imported. If it didn't, in a "
@@ -2434,13 +2526,13 @@ msgstr ""
24342526"効率と一貫性上の理由から、Python "
24352527"はモジュールが最初にインポートされた時にのみモジュールファイルを読み込みます。そうしないと、たくさんのモジュールでできていて、それぞれが同じ基本モジュールをインポートしているようなプログラムでは、その基本モジュールの解析と再解析が繰り返されることになります。変更されさたモジュールの再読込を強制するには、こうしてください::"
24362528
2437- #: ../../faq/programming.rst:1852
2529+ #: ../../faq/programming.rst:1939
24382530msgid ""
24392531"Warning: this technique is not 100% fool-proof. In particular, modules "
24402532"containing statements like ::"
24412533msgstr "注意:この手法は 100%安全とは言えません。とりわけ ::"
24422534
2443- #: ../../faq/programming.rst:1857
2535+ #: ../../faq/programming.rst:1944
24442536msgid ""
24452537"will continue to work with the old version of the imported objects. If the "
24462538"module contains class definitions, existing class instances will *not* be "
@@ -2450,7 +2542,7 @@ msgstr ""
24502542"のような文を含むモジュールは、インポートされたオブジェクトの古いバージョンを使い続けます。そのモジュールにクラス定義が含まれていたら、存在するクラスインスタンスは新しいクラス定義を使うようにアップデート"
24512543" *されません*。これによって以下の矛盾した振舞いがなされえます::"
24522544
2453- #: ../../faq/programming.rst:1870
2545+ #: ../../faq/programming.rst:1957
24542546msgid ""
24552547"The nature of the problem is made clear if you print out the \" identity\" of"
24562548" the class objects::"
0 commit comments