# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2021, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR , YEAR.
#
# Translators:
# Naoki Nakamura , 2020
# tomo, 2020
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-01 16:02+0000\n"
"PO-Revision-Date: 2019-09-01 02:42+0000\n"
"Last-Translator: tomo, 2020\n"
"Language-Team: Japanese (https://www.transifex.com/python-doc/teams/5390/"
"ja/)\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../tutorial/classes.rst:5
msgid "Classes"
msgstr "ã¯ã©ã¹"
#: ../../tutorial/classes.rst:7
msgid ""
"Classes provide a means of bundling data and functionality together. "
"Creating a new class creates a new *type* of object, allowing new "
"*instances* of that type to be made. Each class instance can have "
"attributes attached to it for maintaining its state. Class instances can "
"also have methods (defined by its class) for modifying its state."
msgstr ""
"ã¯ã©ã¹ã¯ãã¼ã¿ã¨æ©è½ãçµã¿åãããæ¹æ³ãæä¾ãã¾ãã\n"
"æ°è¦ã«ã¯ã©ã¹ã使ãããã¨ã§ãæ°ãããªãã¸ã§ã¯ãã® *å* ã使ãããã®åãæ"
"ã¤æ°ãã *ã¤ã³ã¹ã¿ã³ã¹* ãä½ãã¾ãã\n"
"ã¯ã©ã¹ã®ããããã®ã¤ã³ã¹ã¿ã³ã¹ã¯èªèº«ã®ç¶æ
ãä¿æãã屿§ãæã¦ã¾ãã\n"
"ã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ã¯ããã®ç¶æ
ã夿´ããããã® (ãã®ã¯ã©ã¹ãå®ç¾©ãã) ã¡"
"ã½ãããæã¦ã¾ãã"
#: ../../tutorial/classes.rst:13
msgid ""
"Compared with other programming languages, Python's class mechanism adds "
"classes with a minimum of new syntax and semantics. It is a mixture of the "
"class mechanisms found in C++ and Modula-3. Python classes provide all the "
"standard features of Object Oriented Programming: the class inheritance "
"mechanism allows multiple base classes, a derived class can override any "
"methods of its base class or classes, and a method can call the method of a "
"base class with the same name. Objects can contain arbitrary amounts and "
"kinds of data. As is true for modules, classes partake of the dynamic "
"nature of Python: they are created at runtime, and can be modified further "
"after creation."
msgstr ""
"Python ã¯ãä»ã®ããã°ã©ãã³ã°è¨èªã¨æ¯è¼ãã¦ãæå°éã®æ§æã¨æå³ä»ãã使ã£ã¦ã¯"
"ã©ã¹ãè¨èªã«è¿½å ãã¦ãã¾ããPython ã®ã¯ã©ã¹ã¯ãC++ 㨠Modula-3 ã®ã¯ã©ã¹ã¡ã«ã"
"ãºã ãæ··ãããã®ã§ããPython ã®ã¯ã©ã¹æ©æ§ã¯ãªãã¸ã§ã¯ãæåããã°ã©ãã³ã°ã®æ¨"
"æºçãªæ©è½ãå
¨ã¦æä¾ãã¦ãã¾ããã¯ã©ã¹ã®ç¶æ¿ã¡ã«ããºã ã¯ãè¤æ°ã®åºåºã¯ã©ã¹ã"
"æã¤ãã¨ãã§ããæ´¾çã¯ã©ã¹ã§åºåºã¯ã©ã¹ã®ä»»æã®ã¡ã½ããããªã¼ãã©ã¤ããããã¨"
"ãã§ãã¾ããã¡ã½ããã§ã¯ãåºåºã¯ã©ã¹ã®ã¡ã½ãããåãååã§å¼ã³åºããã¨ãã§ã"
"ã¾ãããªãã¸ã§ã¯ãã«ã¯ä»»æã®ç¨®é¡ã¨æ°ã®ãã¼ã¿ãæ ¼ç´ãããã¨ãã§ãã¾ããã¢"
"ã¸ã¥ã¼ã«ã¨åãããã¯ã©ã¹æ©æ§ã Python ã®åçãªæ§è³ªã«å¾ãããã«è¨è¨ããã¦ãã¾"
"ããã¯ã©ã¹ã¯å®è¡æã«çæãããçæå¾ã«å¤æ´ãããã¨ãã§ãã¾ãã"
#: ../../tutorial/classes.rst:23
msgid ""
"In C++ terminology, normally class members (including the data members) are "
"*public* (except see below :ref:`tut-private`), and all member functions are "
"*virtual*. As in Modula-3, there are no shorthands for referencing the "
"object's members from its methods: the method function is declared with an "
"explicit first argument representing the object, which is provided "
"implicitly by the call. As in Smalltalk, classes themselves are objects. "
"This provides semantics for importing and renaming. Unlike C++ and "
"Modula-3, built-in types can be used as base classes for extension by the "
"user. Also, like in C++, most built-in operators with special syntax "
"(arithmetic operators, subscripting etc.) can be redefined for class "
"instances."
msgstr ""
"C++ ã®ç¨èªã§è¨ãã°ãé常ã®ã¯ã©ã¹ã¡ã³ã (ãã¼ã¿ã¡ã³ããå«ã) 㯠(:ref:`tut-"
"private` ã«æ¸ããã¦ããä¾å¤ãé¤ãã¦) *public* ã§ãããã¡ã³ã颿°ã¯ãã¹ã¦ *ä»®"
"æ³é¢æ°(virtual)* ã§ãã Modula-3 ã«ãããããªããªãã¸ã§ã¯ãã®ã¡ã³ããã¡ã½ãã"
"ããåç
§ããããã®ç縮ããè¨æ³ã¯ä½¿ãã¾ãã: ã¡ã½ãã颿°ã®å®£è¨ã§ã¯ããªãã¸ã§"
"ã¯ãèªä½ã表ã第ä¸å¼æ°ãæç¤ºããªããã°ãªãã¾ããã第ä¸å¼æ°ã®ãªãã¸ã§ã¯ãã¯ã¡"
"ã½ããå¼ã³åºãã®éã«æé»ã®å¼æ°ã¨ãã¦æ¸¡ããã¾ãã Smalltalk ã«ä¼¼ã¦ãã¯ã©ã¹ã¯ã"
"ãèªä½ããªãã¸ã§ã¯ãã§ãããã®ããã import ãåå夿´ã¨ãã£ãæä½ãå¯è½ã§"
"ãã C++ ã Modula-3 ã¨éã£ã¦ãã¦ã¼ã¶ã¼ã¯çµè¾¼ã¿åãåºåºã¯ã©ã¹ã«ãã¦æ¡å¼µãè¡ã"
"ã¾ããã¾ããC++ ã¨ã¯åãã§ Modula-3 ã¨ã¯éãç¹ã¨ãã¦ãç¹å¥ãªæ§æãä¼´ãã»ã¨ã"
"ã©ã®çµã¿è¾¼ã¿æ¼ç®å (ç®è¡æ¼ç®å (arithmetic operator) ãæ·»å表è¨) ã¯ã¯ã©ã¹ã¤ã³"
"ã¹ã¿ã³ã¹ã§ä½¿ãããã«åå®ç¾©ã§ãã¾ãã"
#: ../../tutorial/classes.rst:34
msgid ""
"(Lacking universally accepted terminology to talk about classes, I will make "
"occasional use of Smalltalk and C++ terms. I would use Modula-3 terms, "
"since its object-oriented semantics are closer to those of Python than C++, "
"but I expect that few readers have heard of it.)"
msgstr ""
"(ã¯ã©ã¹ã«é¢ãã¦æ®éçãªç¨èªå®ç¾©ããªãã®ã§ã Smalltalk 㨠C++ ã®ç¨èªãå ´åã«å¿"
"ãã¦ä½¿ã£ã¦ãããã¨ã«ãã¾ãã C++ ããã Modula-3 ã®æ¹ããªãã¸ã§ã¯ãæåã®æå³"
"è«ã Python ã«è¿ãã®ã§ã Modula-3 ã®ç¨èªã使ãããã®ã§ãããã»ã¨ãã©ã®èªè
㯠"
"Modula-3 ã«ã¤ãã¦ãããªãã§ãããããã)"
#: ../../tutorial/classes.rst:43
msgid "A Word About Names and Objects"
msgstr "ååã¨ãªãã¸ã§ã¯ãã«ã¤ãã¦"
#: ../../tutorial/classes.rst:45
msgid ""
"Objects have individuality, and multiple names (in multiple scopes) can be "
"bound to the same object. This is known as aliasing in other languages. "
"This is usually not appreciated on a first glance at Python, and can be "
"safely ignored when dealing with immutable basic types (numbers, strings, "
"tuples). However, aliasing has a possibly surprising effect on the "
"semantics of Python code involving mutable objects such as lists, "
"dictionaries, and most other types. This is usually used to the benefit of "
"the program, since aliases behave like pointers in some respects. For "
"example, passing an object is cheap since only a pointer is passed by the "
"implementation; and if a function modifies an object passed as an argument, "
"the caller will see the change --- this eliminates the need for two "
"different argument passing mechanisms as in Pascal."
msgstr ""
"ãªãã¸ã§ã¯ãã«ã¯å使§ããããåä¸ã®ãªãã¸ã§ã¯ãã«(è¤æ°ã®ã¹ã³ã¼ããã) è¤æ°ã®"
"ååãå²ãå½ã¦ããã¨ãã§ãã¾ãããã®æ©è½ã¯ä»ã®è¨èªã§ã¯å¥åã¥ã(alias) ã¨ãã¦"
"ç¥ããã¦ãã¾ãã Python ãä¸è¦ããã ãã§ã¯ãå¥åã¥ãã®éè¦æ§ã¯åãããªããã¨"
"ãå¤ãã夿´ä¸è½ãªåºæ¬å (æ°å¤ãæååãã¿ãã«)ãæ±ãã¨ãã«ã¯ç¡è¦ãã¦å·®ãæ¯ã"
"ããã¾ãããããããªãããå¥åä»ãã¯ããªã¹ããè¾æ¸ãä»ã®å¤ãã®åãªã©ã夿´å¯"
"è½ãªåãæ±ã Python ã³ã¼ãä¸ã§é©ãã¹ã广ãããã¾ããå¥åä»ãã¯ããã¤ãã®ç¹"
"ã§ãã¤ã³ã¿ã®ããã«æ¯èãããã®ãã¨ã¯é常ã¯ããã°ã©ã ã«å©ããããã«ä½¿ããã¾"
"ããä¾ãã°ããªãã¸ã§ã¯ãã®åãæ¸¡ãã¯ãå®è£
ä¸ã¯ãã¤ã³ã¿ã渡ãããã ããªã®ã§ã³"
"ã¹ãã®ä½ãæä½ã«ãªãã¾ããã¾ãã颿°ããããªãã¸ã§ã¯ãã弿°ã¨ãã¦æ¸¡ãããã¨"
"ãã颿°ã®å¼ã³åºãå´ãããªãã¸ã§ã¯ãã«å¯¾ãã夿´ãè¦ããã¨ãã§ãã¾ã --- ãã"
"ã«ããã Pascal ã«ãããããªäºã¤ã®å¼æ°æ¸¡ãæ©æ§ããã¤å¿
è¦ããªããã¦ãã¾ãã"
#: ../../tutorial/classes.rst:61
msgid "Python Scopes and Namespaces"
msgstr "Python ã®ã¹ã³ã¼ãã¨åå空é"
#: ../../tutorial/classes.rst:63
msgid ""
"Before introducing classes, I first have to tell you something about "
"Python's scope rules. Class definitions play some neat tricks with "
"namespaces, and you need to know how scopes and namespaces work to fully "
"understand what's going on. Incidentally, knowledge about this subject is "
"useful for any advanced Python programmer."
msgstr ""
"ã¯ã©ã¹ãç´¹ä»ããåã«ãPython ã®ã¹ã³ã¼ãã®ã«ã¼ã«ã«ã¤ãã¦ãããã¨ã話ãã¦ãããª"
"ããã°ãªãã¾ãããã¯ã©ã¹å®ç¾©ã¯å·§ã¿ãªããªãã¯ãåå空éã«æ½ãã®ã§ãä½ãèµ·ãã£"
"ã¦ããã®ããå®å
¨ã«çè§£ããã«ã¯ãã¹ã³ã¼ãã¨åå空éãã©ã®ããã«åä½ããããç"
"è§£ããå¿
è¦ãããã¾ããã¡ãªã¿ã«ããã®åé¡ã«é¢ããç¥èã¯å
¨ã¦ã® Python ããã°ã©"
"ãã«ã¨ã£ã¦æç¨ã§ãã"
#: ../../tutorial/classes.rst:69
msgid "Let's begin with some definitions."
msgstr "ã¾ãå®ç¾©ããå§ãã¾ãããã"
#: ../../tutorial/classes.rst:71
msgid ""
"A *namespace* is a mapping from names to objects. Most namespaces are "
"currently implemented as Python dictionaries, but that's normally not "
"noticeable in any way (except for performance), and it may change in the "
"future. Examples of namespaces are: the set of built-in names (containing "
"functions such as :func:`abs`, and built-in exception names); the global "
"names in a module; and the local names in a function invocation. In a sense "
"the set of attributes of an object also form a namespace. The important "
"thing to know about namespaces is that there is absolutely no relation "
"between names in different namespaces; for instance, two different modules "
"may both define a function ``maximize`` without confusion --- users of the "
"modules must prefix it with the module name."
msgstr ""
"*åå空é (namespace)* ã¨ã¯ãååãããªãã¸ã§ã¯ãã¸ã®å¯¾å¿ä»ã (mapping) ã§"
"ããã»ã¨ãã©ã®åå空éã¯ãç¾ç¶ã§ã¯ Python ã®è¾æ¸ã¨ãã¦å®è£
ããã¦ãã¾ãããã"
"ã®ãã¨ã¯é常㯠(ããã©ã¼ãã³ã¹ä»¥å¤ã§ã¯) ç®ç«ã¤ãã¨ã¯ãªãããå°æ¥ã¯å¤æ´ããã"
"ããããã¾ãããåå空éã®ä¾ã«ã¯ãçµè¾¼ã¿åã®éå (:func:`abs` çã®é¢æ°ãçµè¾¼"
"ã¿ä¾å¤å)ãã¢ã¸ã¥ã¼ã«å
ã®ã°ãã¼ãã«ãªååã颿°ãå¼ã³åºããã¨ãã®ãã¼ã«ã«ãªå"
"åãããã¾ãããªãã¸ã§ã¯ãã®å±æ§ãããªãéåãã¾ããããæå³ã§ã¯åå空éã§"
"ããåå空éã«ã¤ãã¦ç¥ã£ã¦ããã¹ãéè¦ãªãã¨ã¯ãç°ãªã£ãåå空éã«ããååã®"
"éã«ã¯å
¨ãé¢ä¿ããªãã¨ãããã¨ã§ããä¾ãã°ãäºã¤ã®å¥ã
ã®ã¢ã¸ã¥ã¼ã«ã®ä¸¡æ¹ã§é¢"
"æ° ``maximize`` ã¨ãã颿°ãå®ç¾©ãããã¨ãã§ããå®ç¾©èªä½ã¯æ··åããããã¨ã¯ã"
"ãã¾ãã --- ã¢ã¸ã¥ã¼ã«ã®ã¦ã¼ã¶ã¯ååã®åã«ã¢ã¸ã¥ã¼ã«åãã¤ããªããã°ãªãã¾ã"
"ãã"
#: ../../tutorial/classes.rst:82
msgid ""
"By the way, I use the word *attribute* for any name following a dot --- for "
"example, in the expression ``z.real``, ``real`` is an attribute of the "
"object ``z``. Strictly speaking, references to names in modules are "
"attribute references: in the expression ``modname.funcname``, ``modname`` is "
"a module object and ``funcname`` is an attribute of it. In this case there "
"happens to be a straightforward mapping between the module's attributes and "
"the global names defined in the module: they share the same namespace! [#]_"
msgstr ""
"ã¨ããã§ã *屿§* ã¨ããè¨èã¯ããããã«ç¶ãååãã¹ã¦ã«å¯¾ãã¦ä½¿ã£ã¦ãã¾ã "
"--- ä¾ãã°å¼ ``z.real`` ã§ã ``real`` ã¯ãªãã¸ã§ã¯ã ``z`` ã®å±æ§ã§ããå³å¯ã«"
"ããã°ãã¢ã¸ã¥ã¼ã«å
ã®ååã«å¯¾ããåç
§ã¯å±æ§ã®åç
§ã§ããå¼ ``modname."
"funcname`` ã§ã¯ã ``modname`` ã¯ããã¢ã¸ã¥ã¼ã«ãªãã¸ã§ã¯ãã§ã ``funcname`` "
"ã¯ãã®å±æ§ã§ãããã®å ´åã«ã¯ãã¢ã¸ã¥ã¼ã«ã®å±æ§ã¨ã¢ã¸ã¥ã¼ã«ã®ä¸ã§å®ç¾©ããã¦ã"
"ãã°ãã¼ãã«åã®éã«ã¯ãç´æ¥çãªå¯¾å¿ä»ããããã¾ãããããã®ååã¯åãåå空"
"éãå
±æãã¦ããã®ã§ãï¼ [#]_"
#: ../../tutorial/classes.rst:90
msgid ""
"Attributes may be read-only or writable. In the latter case, assignment to "
"attributes is possible. Module attributes are writable: you can write "
"``modname.the_answer = 42``. Writable attributes may also be deleted with "
"the :keyword:`del` statement. For example, ``del modname.the_answer`` will "
"remove the attribute :attr:`the_answer` from the object named by ``modname``."
msgstr ""
"屿§ã¯èªåãå°ç¨ã«ããæ¸è¾¼ã¿å¯è½ã«ãã§ãã¾ããæ¸è¾¼ã¿å¯è½ã§ããã°ã屿§ã«ä»£å
¥"
"ãããã¨ãã§ãã¾ããã¢ã¸ã¥ã¼ã«å±æ§ã¯æ¸è¾¼ã¿å¯è½ã§ã ``modname.the_answer = "
"42`` ã¨æ¸ããã¨ãã§ãã¾ããæ¸è¾¼ã¿å¯è½ãªå±æ§ã¯ã :keyword:`del` æã§åé¤ããã"
"ã¨ãã§ãã¾ããä¾ãã°ã ``del modname.the_answer`` ã¯ã ``modname`` ã§æå®ãã"
"ããªãã¸ã§ã¯ããã屿§ :attr:`the_answer` ãé¤å»ãã¾ãã"
#: ../../tutorial/classes.rst:96
msgid ""
"Namespaces are created at different moments and have different lifetimes. "
"The namespace containing the built-in names is created when the Python "
"interpreter starts up, and is never deleted. The global namespace for a "
"module is created when the module definition is read in; normally, module "
"namespaces also last until the interpreter quits. The statements executed "
"by the top-level invocation of the interpreter, either read from a script "
"file or interactively, are considered part of a module called :mod:"
"`__main__`, so they have their own global namespace. (The built-in names "
"actually also live in a module; this is called :mod:`builtins`.)"
msgstr ""
"åå空éã¯æ§ã
ãªæç¹ã§ä½æããããã®å¯¿å½ãæ§ã
ã§ããçµã¿è¾¼ã¿ã®ååãå
¥ã£ãå"
"å空é㯠Python ã¤ã³ã¿ããªã¿ãèµ·åããã¨ãã«ä½æãããæ±ºãã¦åé¤ããããã¨ã¯"
"ããã¾ãããã¢ã¸ã¥ã¼ã«ã®ã°ãã¼ãã«ãªåå空éã¯ãã¢ã¸ã¥ã¼ã«å®ç¾©ãèªã¿è¾¼ã¾ãã"
"ã¨ãã«ä½æããã¾ããé常ãã¢ã¸ã¥ã¼ã«ã®åå空éã¯ãã¤ã³ã¿ããªã¿ãçµäºããã¾ã§"
"æ®ãã¾ããã¤ã³ã¿ããªã¿ã®ãããã¬ãã«ã§å®è¡ãããæã¯ãã¹ã¯ãªãããã¡ã¤ã«ãã"
"èªã¿åºããããã®ã§ã対話çã«èªã¿åºããããã®ã§ãã :mod:`__main__` ã¨ããåå"
"ã®ã¢ã¸ã¥ã¼ã«ã®ä¸é¨åã§ããã¨ã¿ãªãããã®ã§ãç¬èªã®åå空éãæã¤ãã¨ã«ãªãã¾"
"ãã (çµã¿è¾¼ã¿ã®ååã¯å®éã«ã¯ã¢ã¸ã¥ã¼ã«å
ã«åå¨ãã¾ãããã®ã¢ã¸ã¥ã¼ã«ã¯ :"
"mod:`builtins` ã¨å¼ã°ãã¦ãã¾ãã)"
#: ../../tutorial/classes.rst:106
msgid ""
"The local namespace for a function is created when the function is called, "
"and deleted when the function returns or raises an exception that is not "
"handled within the function. (Actually, forgetting would be a better way to "
"describe what actually happens.) Of course, recursive invocations each have "
"their own local namespace."
msgstr ""
"颿°ã®ãã¼ã«ã«ãªåå空éã¯ã颿°ãå¼ã³åºãããã¨ãã«ä½æããã颿°ããæ»ã£ã"
"ã¨ããã颿°å
ã§ä¾å¤ãéåºããããã¤é¢æ°å
ã§å¦çãããªãã£ãå ´åã«åé¤ããã¾"
"ãã (å®éã«ã¯ãå¿ãããããã¨è¨ã£ãã»ããèµ·ãã¦ãããã¨ããã表ãã¦ãã¾"
"ãã) ãã¡ãããå帰å¼åºãã®ã¨ãã«ã¯ãåã
ã®å¼ã³åºãã§åèªã®ãã¼ã«ã«ãªåå空"
"éãããã¾ãã"
#: ../../tutorial/classes.rst:112
msgid ""
"A *scope* is a textual region of a Python program where a namespace is "
"directly accessible. \"Directly accessible\" here means that an unqualified "
"reference to a name attempts to find the name in the namespace."
msgstr ""
"*ã¹ã³ã¼ã (scope)* ã¨ã¯ãããåå空éãç´æ¥ã¢ã¯ã»ã¹ã§ãããããªã Python ãã"
"ã°ã©ã ã®ããã¹ãä¸ã®é åã§ãã \"ç´æ¥ã¢ã¯ã»ã¹å¯è½\" ã¨ã¯ã修飾ãªãã« (訳注: "
"``spam.egg`` ã§ã¯ãªãåã« ``egg`` ã®ããã«) ååãåç
§ããéã«ããã®åå空é"
"ããååãè¦ã¤ãããã¨è©¦ã¿ããã¨ãæå³ãã¾ãã"
#: ../../tutorial/classes.rst:116
msgid ""
"Although scopes are determined statically, they are used dynamically. At any "
"time during execution, there are at least three nested scopes whose "
"namespaces are directly accessible:"
msgstr ""
"ã¹ã³ã¼ãã¯éçã«æ±ºå®ããã¾ãããåçã«ä½¿ç¨ããã¾ããå®è¡ä¸ã¯ãã¤ã§ããç´æ¥å"
"å空éã«ã¢ã¯ã»ã¹å¯è½ãªãå°ãªãã¨ãä¸ã¤ã®å
¥ãåã«ãªã£ãã¹ã³ã¼ããããã¾ã:"
#: ../../tutorial/classes.rst:120
msgid "the innermost scope, which is searched first, contains the local names"
msgstr "æåã«æ¢ããããæãå
å´ã®ã¹ã³ã¼ãã¯ããã¼ã«ã«ãªååãæã£ã¦ãã¾ãã"
#: ../../tutorial/classes.rst:121
msgid ""
"the scopes of any enclosing functions, which are searched starting with the "
"nearest enclosing scope, contains non-local, but also non-global names"
msgstr ""
"å¤å´ã®(enclosing)颿°ã®ã¹ã³ã¼ãã¯ãè¿ãã»ãããé ã«æ¢ããããã¼ã«ã«ã§ãã°ãã¼"
"ãã«ã§ããªãååãæã£ã¦ãã¾ãã"
#: ../../tutorial/classes.rst:123
msgid "the next-to-last scope contains the current module's global names"
msgstr "次ã®ã¹ã³ã¼ãã¯ãç¾å¨ã®ã¢ã¸ã¥ã¼ã«ã®ã°ãã¼ãã«ãªååãæã£ã¦ãã¾ãã"
#: ../../tutorial/classes.rst:124
msgid ""
"the outermost scope (searched last) is the namespace containing built-in "
"names"
msgstr "ä¸çªå¤å´ã®(æå¾ã«æ¤ç´¢ããã)ã¹ã³ã¼ãã¯ãã«ãã¤ã³åãæã£ã¦ãã¾ãã"
#: ../../tutorial/classes.rst:126
msgid ""
"If a name is declared global, then all references and assignments go "
"directly to the middle scope containing the module's global names. To "
"rebind variables found outside of the innermost scope, the :keyword:"
"`nonlocal` statement can be used; if not declared nonlocal, those variables "
"are read-only (an attempt to write to such a variable will simply create a "
"*new* local variable in the innermost scope, leaving the identically named "
"outer variable unchanged)."
msgstr ""
"ååã global ã¨å®£è¨ããã¦ããå ´åããã®ååã«å¯¾ããåç
§ã代å
¥ã¯å
¨ã¦ãã¢"
"ã¸ã¥ã¼ã«ã®ã°ãã¼ãã«ãªååã®å
¥ã£ãä¸éã®ã¹ã³ã¼ãã«å¯¾ãã¦ç´æ¥è¡ããã¾ããæå
"
"ã¹ã³ã¼ãã®å¤å´ã«ãã夿°ã«åæç¸ããã«ã¯ã :keyword:`nonlocal` æã使ãã¾ãã"
"nonlocal ã¨å®£è¨ãããªãã£ã夿°ã¯ãå
¨ã¦èªã¿åºãå°ç¨ã¨ãªãã¾ã (ãã®ãããªå¤æ°"
"ã«å¯¾ããæ¸ãè¾¼ã¿ã¯ãåã« *æ°ãã* ãã¼ã«ã«å¤æ°ããã£ã¨ãå
å´ã®ã¹ã³ã¼ãã§ä½æ"
"ããå¤é¨ã®ã¹ã³ã¼ãã®å¤ã¯å¤åãã¾ãã)ã"
#: ../../tutorial/classes.rst:133
msgid ""
"Usually, the local scope references the local names of the (textually) "
"current function. Outside functions, the local scope references the same "
"namespace as the global scope: the module's namespace. Class definitions "
"place yet another namespace in the local scope."
msgstr ""
"é常ããã¼ã«ã«ã¹ã³ã¼ã㯠(ããã°ã©ã ããã¹ãä¸ã®) ç¾å¨ã®é¢æ°ã®ãã¼ã«ã«ãªåå"
"ãåç
§ãã¾ãã颿°ã®å¤å´ã§ã¯ããã¼ã«ã«ã¹ã³ã¼ãã¯ã°ãã¼ãã«ãªåå空éã¨åãå"
"å空éãã¢ã¸ã¥ã¼ã«ã®åå空éãåç
§ãã¾ããã¯ã©ã¹å®ç¾©ã§ã¯ããã¼ã«ã«ã¹ã³ã¼ãã®"
"ä¸ã«ããä¸ã¤åå空éãç½®ããã¾ãã"
#: ../../tutorial/classes.rst:138
msgid ""
"It is important to realize that scopes are determined textually: the global "
"scope of a function defined in a module is that module's namespace, no "
"matter from where or by what alias the function is called. On the other "
"hand, the actual search for names is done dynamically, at run time --- "
"however, the language definition is evolving towards static name resolution, "
"at \"compile\" time, so don't rely on dynamic name resolution! (In fact, "
"local variables are already determined statically.)"
msgstr ""
"ã¹ã³ã¼ãã¯ããã¹ãä¸ã§æ±ºå®ããã¦ããã¨çè§£ãããã¨ãéè¦ã§ããã¢ã¸ã¥ã¼ã«å
ã§"
"å®ç¾©ããã颿°ã®ã°ãã¼ãã«ãªã¹ã³ã¼ãã¯ã颿°ãã©ãããå¼ã³åºããã¦ããã©ããª"
"å¥åãã¤ãã¦å¼ã³åºããã¦ãããã®ã¢ã¸ã¥ã¼ã«ã®åå空éã«ãªãã¾ããå対ã«ãå®é"
"ã®ååã®æ¤ç´¢ã¯å®è¡æã«åçã«è¡ããã¾ã --- ã¨ã¯ãããè¨èªã®å®ç¾©ã¯ã\"ã³ã³ãã¤"
"ã«\" æã®éçãªååè§£æ±ºã®æ¹åã«é²åãã¦ããã®ã§ãåçãªåå解決ã«é ¼ã£ã¦ã¯ãã"
"ã¾ããï¼ (äºå®ããã¼ã«ã«ãªå¤æ°ã¯æ¢ã«éçã«æ±ºå®ããã¦ãã¾ãã)"
#: ../../tutorial/classes.rst:146
msgid ""
"A special quirk of Python is that -- if no :keyword:`global` or :keyword:"
"`nonlocal` statement is in effect -- assignments to names always go into the "
"innermost scope. Assignments do not copy data --- they just bind names to "
"objects. The same is true for deletions: the statement ``del x`` removes "
"the binding of ``x`` from the namespace referenced by the local scope. In "
"fact, all operations that introduce new names use the local scope: in "
"particular, :keyword:`import` statements and function definitions bind the "
"module or function name in the local scope."
msgstr ""
"Python ã®ç¹å¾´ã¨ãã¦ã:keyword:`global` ã :keyword:`nonlocal` æãæå¹ã§ãªã"
"å ´åã¯ãååã«å¯¾ããåç
§ã¯å¸¸ã«æãå
å´ã®ã¹ã³ã¼ãã«å¯¾ãã¦æå¹ã«ãªãã¾ãã\n"
"代å
¥ã¯ãã¼ã¿ãã³ãã¼ãã¾ããããªãã¸ã§ã¯ããååã«æç¸ããã ãã§ããåé¤ãå"
"æ§ã§ã``del x`` ã¯ããã¼ã«ã«ã¹ã³ã¼ãã®åå空éãã ``x`` ã«å¯¾ããææãåã"
"é¤ãã¾ãã\n"
"ã¤ã¾ãã¨ãããæ°ããååãä¸ãããããªãã¹ã¦ã®æä½ã¯ããã¼ã«ã«ã¹ã³ã¼ãã使ã£"
"ã¦è¡ããã¾ãã :keyword:`import` æã颿°ã®å®ç¾©ã¯ãã¢ã¸ã¥ã¼ã«ã颿°åããã¼ã«"
"ã«ã¹ã³ã¼ãã®ååã«ææãã¾ãã"
#: ../../tutorial/classes.rst:154
msgid ""
"The :keyword:`global` statement can be used to indicate that particular "
"variables live in the global scope and should be rebound there; the :keyword:"
"`nonlocal` statement indicates that particular variables live in an "
"enclosing scope and should be rebound there."
msgstr ""
":keyword:`global` æã使ãã¨ãç¹å®ã®å¤æ°ãã°ãã¼ãã«ã¹ã³ã¼ãã«åå¨ããããã§"
"åæç¸ããããã¨ãæç¤ºã§ãã¾ãã :keyword:`nonlocal` æã¯ãç¹å®ã®å¤æ°ãå¤å´ã®"
"ã¹ã³ã¼ãã«åå¨ããããã§åæç¸ããããã¨ãæç¤ºãã¾ãã"
#: ../../tutorial/classes.rst:162
msgid "Scopes and Namespaces Example"
msgstr "ã¹ã³ã¼ãã¨åå空éã®ä¾"
#: ../../tutorial/classes.rst:164
msgid ""
"This is an example demonstrating how to reference the different scopes and "
"namespaces, and how :keyword:`global` and :keyword:`nonlocal` affect "
"variable binding::"
msgstr ""
"ç°ãªãã¹ã³ã¼ãã¨åå空éãã©ã®ããã«åç
§ãããããã¾ã :keyword:`global` ãã"
"ã³ :keyword:`nonlocal` ã夿°ã®æç¸ã«ã©ãå½±é¿ãããããã®ä¾ã§å®æ¼ãã¾ã::"
#: ../../tutorial/classes.rst:191
msgid "The output of the example code is:"
msgstr "ãã®ã³ã¼ãä¾ã®åºåã¯:"
#: ../../tutorial/classes.rst:200
msgid ""
"Note how the *local* assignment (which is default) didn't change "
"*scope_test*\\'s binding of *spam*. The :keyword:`nonlocal` assignment "
"changed *scope_test*\\'s binding of *spam*, and the :keyword:`global` "
"assignment changed the module-level binding."
msgstr ""
"ãã®ã¨ããã(ããã©ã«ãã®) *ãã¼ã«ã«ãª* 代å
¥ã¯ *scope_test* ä¸ã® *spam* ã¸ã®"
"æç¸ã夿´ãã¾ããã§ããã :keyword:`nonlocal` 代å
¥ã¯ *scope_test* ä¸ã® "
"*spam* ã¸ã®æç¸ã夿´ãã :keyword:`global` 代å
¥ã¯ã¢ã¸ã¥ã¼ã«ã¬ãã«ã®æç¸ãå¤"
"æ´ãã¾ããã"
#: ../../tutorial/classes.rst:205
msgid ""
"You can also see that there was no previous binding for *spam* before the :"
"keyword:`global` assignment."
msgstr ""
"ã¾ãããããã :keyword:`global` 代å
¥ã®åã«ã¯ *spam* ã«ä½ãæç¸ããã¦ããªãã£"
"ããã¨ãåããã¾ãã"
#: ../../tutorial/classes.rst:212
msgid "A First Look at Classes"
msgstr "ã¯ã©ã¹åè¦"
#: ../../tutorial/classes.rst:214
msgid ""
"Classes introduce a little bit of new syntax, three new object types, and "
"some new semantics."
msgstr ""
"ã¯ã©ã¹ã§ã¯ãæ°ããæ§æãå°ãã¨ãä¸ã¤ã®æ°ããªãªãã¸ã§ã¯ãåãããã¦æ°ããªæå³"
"ä»ããããã¤ãåãå
¥ãã¦ãã¾ãã"
#: ../../tutorial/classes.rst:221
msgid "Class Definition Syntax"
msgstr "ã¯ã©ã¹å®ç¾©ã®æ§æ"
#: ../../tutorial/classes.rst:223
msgid "The simplest form of class definition looks like this::"
msgstr "ã¯ã©ã¹å®ç¾©ã®æãåç´ãªå½¢å¼ã¯ã次ã®ããã«ãªãã¾ã::"
#: ../../tutorial/classes.rst:232
msgid ""
"Class definitions, like function definitions (:keyword:`def` statements) "
"must be executed before they have any effect. (You could conceivably place "
"a class definition in a branch of an :keyword:`if` statement, or inside a "
"function.)"
msgstr ""
"颿°å®ç¾© (:keyword:`def` æ) ã¨åæ§ãã¯ã©ã¹å®ç¾©ã广ããã¤ã«ã¯ã¾ãå®è¡ããªã"
"ãã°ãªãã¾ããã (ã¯ã©ã¹å®ç¾©ã :keyword:`if` æã®åå²å
ã颿°å
é¨ã«ç½®ããã¨"
"ããèãæ¹ã¨ãã¦ã¯ãããã¾ãã)"
#: ../../tutorial/classes.rst:236
msgid ""
"In practice, the statements inside a class definition will usually be "
"function definitions, but other statements are allowed, and sometimes useful "
"--- we'll come back to this later. The function definitions inside a class "
"normally have a peculiar form of argument list, dictated by the calling "
"conventions for methods --- again, this is explained later."
msgstr ""
"å®éã«ã¯ãã¯ã©ã¹å®ç¾©ã®å
å´ã«ããæã¯ãé常ã¯é¢æ°å®ç¾©ã«ãªãã¾ãããä»ã®æãæ¸"
"ããã¨ãã§ãããããå½¹ã«ç«ã¤ãã¨ãããã¾ã --- ããã«ã¤ãã¦ã¯å¾ã§è¿°ã¹ã¾ããã¯"
"ã©ã¹å
ã®é¢æ°å®ç¾©ã¯é常ãã¡ã½ããã®å¼ã³åºãè¦ç´ã§æ±ºããããç¬ç¹ã®å½¢å¼ã®å¼æ°ãª"
"ã¹ããæã¡ã¾ã --- ããã«ã¤ãã¦ãå¾ã§è¿°ã¹ã¾ãã"
#: ../../tutorial/classes.rst:242
msgid ""
"When a class definition is entered, a new namespace is created, and used as "
"the local scope --- thus, all assignments to local variables go into this "
"new namespace. In particular, function definitions bind the name of the new "
"function here."
msgstr ""
"ã¯ã©ã¹å®ç¾©ã«å
¥ãã¨ãæ°ããªåå空éã使ããããã¼ã«ã«ãªåå空éã¨ãã¦ä½¿ãã"
"ã¾ã --- å¾ã£ã¦ããã¼ã«ã«ãªå¤æ°ã«å¯¾ããå
¨ã¦ã®ä»£å
¥ã¯ãã®æ°ããªåå空éã«å
¥ãã¾"
"ããç¹ã«ã颿°å®ç¾©ãè¡ãã¨ãæ°ããªé¢æ°ã®ååã¯ãã®åå空éã«çµã³ä»ãããã¾"
"ãã"
#: ../../tutorial/classes.rst:247
msgid ""
"When a class definition is left normally (via the end), a *class object* is "
"created. This is basically a wrapper around the contents of the namespace "
"created by the class definition; we'll learn more about class objects in the "
"next section. The original local scope (the one in effect just before the "
"class definition was entered) is reinstated, and the class object is bound "
"here to the class name given in the class definition header (:class:"
"`ClassName` in the example)."
msgstr ""
"ã¯ã©ã¹å®ç¾©ããæ®éã« (å®ç¾©ã®çµç«¯ã«å°éãã¦) æããã¨ã *ã¯ã©ã¹ãªãã¸ã§ã¯ã "
"(class object)* ãçæããã¾ããã¯ã©ã¹ãªãã¸ã§ã¯ãã¯ãåºæ¬çã«ã¯ã¯ã©ã¹å®ç¾©ã§"
"使ãããåå空éã®å
容ããããã©ãã (wrapper) ã§ããã¯ã©ã¹ãªãã¸ã§ã¯ãã«ã¤"
"ãã¦ã¯æ¬¡ã®ç¯ã§è©³ããå¦ã¶ãã¨ã«ãã¾ãã (ã¯ã©ã¹å®ç¾©ã«å
¥ãåã«æå¹ã ã£ã) å
ã®"
"ãã¼ã«ã«ã¹ã³ã¼ãã復帰ããçæãããã¯ã©ã¹ãªãã¸ã§ã¯ãã¯å¾©å¸°ãããã¼ã«ã«ã¹"
"ã³ã¼ãã«ã¯ã©ã¹å®ç¾©ã®ãããã§æå®ããåå (ä¸ã®ä¾ã§ã¯ :class:`ClassName`) ã§çµ"
"ã³ä»ãããã¾ãã"
#: ../../tutorial/classes.rst:259
msgid "Class Objects"
msgstr "ã¯ã©ã¹ãªãã¸ã§ã¯ã"
#: ../../tutorial/classes.rst:261
msgid ""
"Class objects support two kinds of operations: attribute references and "
"instantiation."
msgstr ""
"ã¯ã©ã¹ãªãã¸ã§ã¯ãã§ã¯ï¼ç¨®é¡ã®æ¼ç®ã屿§åç
§ã¨ã¤ã³ã¹ã¿ã³ã¹çæããµãã¼ããã¦"
"ãã¾ãã"
#: ../../tutorial/classes.rst:264
msgid ""
"*Attribute references* use the standard syntax used for all attribute "
"references in Python: ``obj.name``. Valid attribute names are all the names "
"that were in the class's namespace when the class object was created. So, "
"if the class definition looked like this::"
msgstr ""
"*屿§åç
§ (attribute reference)* ã¯ãPython ã«ããããã¹ã¦ã®å±æ§åç
§ã§ä½¿ãã"
"ã¦ããæ¨æºçãªæ§æã ``obj.name`` ã使ãã¾ããã¯ã©ã¹ãªãã¸ã§ã¯ããçæããã"
"éã«ã¯ã©ã¹ã®åå空éã«ãã£ãååãã¹ã¦ãæå¹ãªå±æ§åã§ããå¾ã£ã¦ã以ä¸ã®ãã"
"ãªã¯ã©ã¹å®ç¾©ã§ã¯::"
#: ../../tutorial/classes.rst:276
msgid ""
"then ``MyClass.i`` and ``MyClass.f`` are valid attribute references, "
"returning an integer and a function object, respectively. Class attributes "
"can also be assigned to, so you can change the value of ``MyClass.i`` by "
"assignment. :attr:`__doc__` is also a valid attribute, returning the "
"docstring belonging to the class: ``\"A simple example class\"``."
msgstr ""
"``MyClass.i`` 㨠``MyClass.f`` ã¯å¦¥å½ãªå±æ§åç
§ã§ãããããããæ´æ°ã¨é¢æ°ãªã"
"ã¸ã§ã¯ããè¿ãã¾ããã¯ã©ã¹å±æ§ã«ä»£å
¥ãè¡ããã¨ãã§ãã¾ããå¾ã£ã¦ã ``MyClass."
"i`` ã®å¤ã代å
¥ãã¦å¤æ´ã§ãã¾ãã :attr:`__doc__` ãæå¹ãªå±æ§ã§ããã®ã¯ã©ã¹ã«"
"å±ãã¦ãã docstringããã®å ´å㯠``\"A simple example class\"`` ãè¿ãã¾ãã"
#: ../../tutorial/classes.rst:282
msgid ""
"Class *instantiation* uses function notation. Just pretend that the class "
"object is a parameterless function that returns a new instance of the class. "
"For example (assuming the above class)::"
msgstr ""
"ã¯ã©ã¹ã® *ã¤ã³ã¹ã¿ã³ã¹å (instantiation)* ã«ã¯é¢æ°ã®ãããªè¡¨è¨æ³ã使ãã¾ãã"
"ã¯ã©ã¹ãªãã¸ã§ã¯ãã®ãã¨ããåã«ã¯ã©ã¹ã®æ°ããã¤ã³ã¹ã¿ã³ã¹ãè¿ã弿°ããªãé¢"
"æ°ã®ããã«æ¯ãèãã¾ããä¾ãã° (ä¸è¨ã®ã¯ã©ã¹ã§ããã°)::"
#: ../../tutorial/classes.rst:288
msgid ""
"creates a new *instance* of the class and assigns this object to the local "
"variable ``x``."
msgstr ""
"ã¯ãã¯ã©ã¹ã®æ°ãã *ã¤ã³ã¹ã¿ã³ã¹ (instance)* ãçæãããã®ãªãã¸ã§ã¯ãããã¼"
"ã«ã«å¤æ° ``x`` ã¸ä»£å
¥ãã¾ãã"
#: ../../tutorial/classes.rst:291
msgid ""
"The instantiation operation (\"calling\" a class object) creates an empty "
"object. Many classes like to create objects with instances customized to a "
"specific initial state. Therefore a class may define a special method named :"
"meth:`__init__`, like this::"
msgstr ""
"ãã®ã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹çææä½ (ã¯ã©ã¹ãªãã¸ã§ã¯ãã® \"å¼åºã\") ãè¡ãã¨ã"
"空ã®ãªãã¸ã§ã¯ããçæãã¾ããå¤ãã®ã¯ã©ã¹ã¯ããªãã¸ã§ã¯ãã使ããéã«ãã«"
"ã¹ã¿ãã¤ãºãããç¹å®ã®åæç¶æ
ã«ãªã£ã¦ã»ããã¨æãã§ãã¾ãããã®ããã«ãã¯ã©"
"ã¹ã«ã¯ :meth:`__init__` ã¨ããååã®ç¹å¥ãªã¡ã½ããå®ç¾©ãããã¨ãã§ãã¾ããä¾"
"ãã°æ¬¡ã®ããã«ãã¾ã::"
#: ../../tutorial/classes.rst:299
msgid ""
"When a class defines an :meth:`__init__` method, class instantiation "
"automatically invokes :meth:`__init__` for the newly-created class "
"instance. So in this example, a new, initialized instance can be obtained "
"by::"
msgstr ""
"ã¯ã©ã¹ã :meth:`__init__` ã¡ã½ãããå®ç¾©ãã¦ããå ´åãã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ã"
"çæããã¨ãæ°ããçæãããã¯ã©ã¹ã¤ã³ã¹ã¿ã³ã¹ã«å¯¾ãã¦èªåçã« :meth:"
"`__init__` ãå¼ã³åºãã¾ããå¾ã£ã¦ããã®ä¾ã§ã¯ãæ°ããªåææ¸ã¿ã®ã¤ã³ã¹ã¿ã³ã¹ã"
"次ã®ããã«ãã¦å¾ããã¨ãã§ãã¾ã::"
#: ../../tutorial/classes.rst:305
msgid ""
"Of course, the :meth:`__init__` method may have arguments for greater "
"flexibility. In that case, arguments given to the class instantiation "
"operator are passed on to :meth:`__init__`. For example, ::"
msgstr ""
"ãã¡ããããã大ããªæè»æ§ãæãããããã«ã :meth:`__init__` ã¡ã½ããã«è¤æ°"
"ã®å¼æ°ããããããã¨ãã§ãã¾ãããã®å ´åãæ¬¡ã®ä¾ã®ããã«ãã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³"
"ã¹çææä½ã«æ¸¡ããã弿°ã¯ :meth:`__init__` ã«æ¸¡ããã¾ããä¾ãã°ã ::"
#: ../../tutorial/classes.rst:322
msgid "Instance Objects"
msgstr "ã¤ã³ã¹ã¿ã³ã¹ãªãã¸ã§ã¯ã"
#: ../../tutorial/classes.rst:324
msgid ""
"Now what can we do with instance objects? The only operations understood by "
"instance objects are attribute references. There are two kinds of valid "
"attribute names: data attributes and methods."
msgstr ""
"ã¨ããã§ãã¤ã³ã¹ã¿ã³ã¹ãªãã¸ã§ã¯ãã使ãã¨ä½ãã§ããã®ã§ããããï¼ã¤ã³ã¹ã¿ã³"
"ã¹ãªãã¸ã§ã¯ããçè§£ã§ããå¯ä¸ã®æä½ã¯ã屿§ã®åç
§ã§ããæå¹ãªå±æ§åã«ã¯ "
"(ãã¼ã¿å±æ§ããã³ã¡ã½ããã®) äºç¨®é¡ããã¾ãã"
#: ../../tutorial/classes.rst:328
msgid ""
"*data attributes* correspond to \"instance variables\" in Smalltalk, and to "
"\"data members\" in C++. Data attributes need not be declared; like local "
"variables, they spring into existence when they are first assigned to. For "
"example, if ``x`` is the instance of :class:`MyClass` created above, the "
"following piece of code will print the value ``16``, without leaving a "
"trace::"
msgstr ""
"*ãã¼ã¿å±æ§ (data attribute)* ã¯ããã㯠Smalltalk ã® \"ã¤ã³ã¹ã¿ã³ã¹å¤æ°\" "
"ã C++ã® \"ãã¼ã¿ã¡ã³ã\" ã«ç¸å½ãã¾ãããã¼ã¿å±æ§ã宣è¨ããå¿
è¦ã¯ããã¾ã"
"ãããã¼ã«ã«ãªå¤æ°ã¨åæ§ã«ããããã®å±æ§ã¯æåã«ä»£å
¥ãããæç¹ã§æ¹§ãåºã¦ãã¾"
"ããä¾ãã°ãä¸ã§çæãã :class:`MyClass` ã®ã¤ã³ã¹ã¿ã³ã¹ ``x`` ã«å¯¾ãã¦ã次ã®"
"ã³ã¼ããå®è¡ããã¨ãå¤ ``16`` ãå°åãã ``x`` ã®çè·¡ã¯æ®ãã¾ãã::"
#: ../../tutorial/classes.rst:340
msgid ""
"The other kind of instance attribute reference is a *method*. A method is a "
"function that \"belongs to\" an object. (In Python, the term method is not "
"unique to class instances: other object types can have methods as well. For "
"example, list objects have methods called append, insert, remove, sort, and "
"so on. However, in the following discussion, we'll use the term method "
"exclusively to mean methods of class instance objects, unless explicitly "
"stated otherwise.)"
msgstr ""
"ããã²ã¨ã¤ã®ã¤ã³ã¹ã¿ã³ã¹å±æ§ã¯ *ã¡ã½ãã (method)* ã§ããã¡ã½ããã¨ã¯ããªã"
"ã¸ã§ã¯ãã« \"å±ãã¦ãã\" 颿°ã®ãã¨ã§ãã(Python ã§ã¯ãã¡ã½ããã¨ããç¨èªã¯"
"ã¯ã©ã¹ã¤ã³ã¹ã¿ã³ã¹ã ãã®ãã®ã§ã¯ããã¾ããããªãã¸ã§ã¯ãåã«ãã¡ã½ãããæã¤"
"ãã¨ãã§ãã¾ããä¾ãã°ããªã¹ããªãã¸ã§ã¯ãã«ã¯ã append, insert, remove, "
"sort ãªã©ã¨ãã£ãã¡ã½ãããããã¾ããã¨ã¯ããã以ä¸ã§ã¯ç¹ã«æè¨ããªãéããã¯"
"ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ãªãã¸ã§ã¯ãã®ã¡ã½ããã ããæå³ãããã®ã¨ãã¦ä½¿ããã¨ã«ã"
"ã¾ãã)"
#: ../../tutorial/classes.rst:349
msgid ""
"Valid method names of an instance object depend on its class. By "
"definition, all attributes of a class that are function objects define "
"corresponding methods of its instances. So in our example, ``x.f`` is a "
"valid method reference, since ``MyClass.f`` is a function, but ``x.i`` is "
"not, since ``MyClass.i`` is not. But ``x.f`` is not the same thing as "
"``MyClass.f`` --- it is a *method object*, not a function object."
msgstr ""
"ã¤ã³ã¹ã¿ã³ã¹ãªãã¸ã§ã¯ãã§æå¹ãªã¡ã½ããåã¯ããã®ã¯ã©ã¹ã«ããã¾ããå®ç¾©ã«ã"
"ããã¯ã©ã¹ã®å
¨ã¦ã®é¢æ°ãªãã¸ã§ã¯ãã§ãã屿§ãã¤ã³ã¹ã¿ã³ã¹ãªãã¸ã§ã¯ãã®å¦¥å½"
"ãªã¡ã½ããåã«æ±ºã¾ãã¾ããå¾ã£ã¦ãä¾ã§ã¯ã``MyClass.f`` ã¯é¢æ°ãªã®ã§ã``x."
"f`` ã¯ã¡ã½ããã®åç
§ã¨ãã¦æå¹ã§ãããããã``MyClass.i`` ã¯é¢æ°ã§ã¯ãªãã®"
"ã§ã``x.i`` ã¯ã¡ã½ããã®åç
§ã¨ãã¦æå¹ã§ã¯ããã¾ããã``x.f`` 㯠``MyClass."
"f`` ã¨åããã®ã§ã¯ããã¾ãã --- 颿°ãªãã¸ã§ã¯ãã§ã¯ãªãã*ã¡ã½ãããªãã¸ã§"
"ã¯ã (method object)* ã§ãã"
#: ../../tutorial/classes.rst:360
msgid "Method Objects"
msgstr "ã¡ã½ãããªãã¸ã§ã¯ã"
#: ../../tutorial/classes.rst:362
msgid "Usually, a method is called right after it is bound::"
msgstr "æ®éãã¡ã½ããã¯ãã¤ã³ããããç´å¾ã«å¼ã³åºããã¾ã::"
#: ../../tutorial/classes.rst:366
msgid ""
"In the :class:`MyClass` example, this will return the string ``'hello "
"world'``. However, it is not necessary to call a method right away: ``x.f`` "
"is a method object, and can be stored away and called at a later time. For "
"example::"
msgstr ""
":class:`MyClass` ã®ä¾ã§ã¯ãä¸ã®ã³ã¼ãã¯æåå ``'hello world'`` ãè¿ãã§ãã"
"ããããããªãããå¿
ãããã¡ã½ããããã®å ´ã§å¼ã³åºããªããã°ãªããªãããã§ã¯"
"ããã¾ããã ``x.f`` ã¯ã¡ã½ãããªãã¸ã§ã¯ãã§ãããã©ããã«è¨æ¶ãã¦ããã¦å¾ã§"
"å¼ã³åºããã¨ãã§ãã¾ããä¾ãã°æ¬¡ã®ã³ã¼ãã¯::"
#: ../../tutorial/classes.rst:374
msgid "will continue to print ``hello world`` until the end of time."
msgstr "``hello world`` ãæãçµããã¾ã§å°åãç¶ããã§ãããã"
#: ../../tutorial/classes.rst:376
msgid ""
"What exactly happens when a method is called? You may have noticed that ``x."
"f()`` was called without an argument above, even though the function "
"definition for :meth:`f` specified an argument. What happened to the "
"argument? Surely Python raises an exception when a function that requires an "
"argument is called without any --- even if the argument isn't actually "
"used..."
msgstr ""
"ã¡ã½ãããå¼ã³åºãããã¨ãã«ã¯å®éã«ã¯ä½ãèµ·ãã¦ããã®ã§ããããï¼ :meth:`f` "
"ã®é¢æ°å®ç¾©ã§ã¯å¼æ°ãä¸ã¤æå®ãã¦ããã«ãããããããä¸ã®ä¾ã§ã¯ ``x.f()`` ãå¼"
"æ°ãªãã§å¼ã³åºããã¦ãã¾ãã弿°ã¯ã©ããªã£ãã®ã§ããããï¼ãããã弿°ãå¿
è¦"
"ãªé¢æ°ã弿°ç¡ãã§å¼ã³åºãã¨ã Python ãä¾å¤ãéåºããã¯ãã§ã --- ãã¨ããã®"
"弿°ãå®éã«ã¯ä½¿ãããªãã¦ãâ¦ã"
#: ../../tutorial/classes.rst:382
msgid ""
"Actually, you may have guessed the answer: the special thing about methods "
"is that the instance object is passed as the first argument of the "
"function. In our example, the call ``x.f()`` is exactly equivalent to "
"``MyClass.f(x)``. In general, calling a method with a list of *n* arguments "
"is equivalent to calling the corresponding function with an argument list "
"that is created by inserting the method's instance object before the first "
"argument."
msgstr ""
"ããçã¯æ³åã§ãã¦ããããããã¾ããã:\n"
"ã¡ã½ããã«ã¤ãã¦ç¹å¥ãªãã¨ã¨ãã¦ãã¤ã³ã¹ã¿ã³ã¹ãªãã¸ã§ã¯ãã颿°ã®ç¬¬1弿°ã¨ã"
"ã¦æ¸¡ããã¾ãã\n"
"ä¾ã§ã¯ã ``x.f()`` ã¨ããå¼ã³åºãã¯ã ``MyClass.f(x)`` ã¨å³å¯ã«ç価ãªãã®ã§"
"ãã\n"
"ä¸è¬ã«ã *n* åã®å¼æ°ãªã¹ããã£ãã¡ã½ããã®å¼åºãã¯ããã®ã¡ã½ããã®ã¤ã³ã¹ã¿ã³"
"ã¹ãªãã¸ã§ã¯ããæåã®å¼æ°ã®åã«æ¿å
¥ãã弿°ãªã¹ãã§ãã¡ã½ããã«å¯¾å¿ãã颿°"
"ãå¼ã³åºããã¨ã¨ç価ã§ãã"
#: ../../tutorial/classes.rst:389
msgid ""
"If you still don't understand how methods work, a look at the implementation "
"can perhaps clarify matters. When a non-data attribute of an instance is "
"referenced, the instance's class is searched. If the name denotes a valid "
"class attribute that is a function object, a method object is created by "
"packing (pointers to) the instance object and the function object just found "
"together in an abstract object: this is the method object. When the method "
"object is called with an argument list, a new argument list is constructed "
"from the instance object and the argument list, and the function object is "
"called with this new argument list."
msgstr ""
"ããã¾ã ã¡ã½ããã®åä½ãçè§£ã§ããªããã°ãä¸åº¦å®è£
ãè¦ã¦ã¿ãã¨äºæ
ãããåã"
"ãããããã¾ãããã¤ã³ã¹ã¿ã³ã¹ã®éãã¼ã¿å±æ§ãåç
§ãããã¨ãã¯ããã®ã¤ã³ã¹ã¿"
"ã³ã¹ã®ã¯ã©ã¹ãæ¤ç´¢ããã¾ãããã®ååãæå¹ãªã¯ã©ã¹å±æ§ã表ãã¦ãã颿°ãªã"
"ã¸ã§ã¯ããªããã¤ã³ã¹ã¿ã³ã¹ãªãã¸ã§ã¯ãã¨è¦ã¤ãã£ã颿°ãªãã¸ã§ã¯ã (ã¸ã®ãã¤"
"ã³ã¿) ãæ½è±¡ãªãã¸ã§ã¯ããããªãã¡ã¡ã½ãããªãã¸ã§ã¯ãã«ããã¯ãã¦ä½æãã¾"
"ããã¡ã½ãããªãã¸ã§ã¯ãã弿°ãªã¹ãã¨å
±ã«å¼ã³åºãããã¨ããã¤ã³ã¹ã¿ã³ã¹ãªã"
"ã¸ã§ã¯ãã¨æ¸¡ããã弿°ãªã¹ãããæ°ãã弿°ãªã¹ãã使ãã¦ãå
ã®é¢æ°ãªãã¸ã§"
"ã¯ããæ°ãã弿°ãªã¹ãã§å¼ã³åºãã¾ãã"
#: ../../tutorial/classes.rst:403
msgid "Class and Instance Variables"
msgstr "ã¯ã©ã¹ã¨ã¤ã³ã¹ã¿ã³ã¹å¤æ°"
#: ../../tutorial/classes.rst:405
msgid ""
"Generally speaking, instance variables are for data unique to each instance "
"and class variables are for attributes and methods shared by all instances "
"of the class::"
msgstr ""
"ä¸è¬çã«ãã¤ã³ã¹ã¿ã³ã¹å¤æ°ã¯ããããã®ã¤ã³ã¹ã¿ã³ã¹ã«ã¤ãã¦åºæã®ãã¼ã¿ã®ãã"
"ã®ãã®ã§ãã¯ã©ã¹å¤æ°ã¯ãã®ã¯ã©ã¹ã®ãã¹ã¦ã®ã¤ã³ã¹ã¿ã³ã¹ã«ãã£ã¦å
±æããã屿§"
"ãã¡ã½ããã®ããã®ãã®ã§ã::"
#: ../../tutorial/classes.rst:427
msgid ""
"As discussed in :ref:`tut-object`, shared data can have possibly surprising "
"effects with involving :term:`mutable` objects such as lists and "
"dictionaries. For example, the *tricks* list in the following code should "
"not be used as a class variable because just a single list would be shared "
"by all *Dog* instances::"
msgstr ""
":ref:`tut-object` ã§è°è«ããããã«ãå
±æãã¼ã¿ã¯ãªã¹ããè¾æ¸ã®ãã㪠:term:"
"`mutable` ãªãã¸ã§ã¯ããé¢ä¸ããã¨é©ãã¹ã广ãæã¡å¾ã¾ããä¾ãã°ã以ä¸ã®"
"ã³ã¼ãã® *tricks* ãªã¹ãã¯ã¯ã©ã¹å¤æ°ã¨ãã¦ä½¿ãããã¹ãã§ã¯ããã¾ããããªããª"
"ããã£ãä¸ã¤ã®ãªã¹ãããã¹ã¦ã® *Dog* ã¤ã³ã¹ã¿ã³ã¹ã«ãã£ã¦å
±æããããã¨ã«ãªã"
"å¾ãããã§ã::"
#: ../../tutorial/classes.rst:450
msgid "Correct design of the class should use an instance variable instead::"
msgstr "ãã®ã¯ã©ã¹ã®æ£ããè¨è¨ã§ã¯ã¤ã³ã¹ã¿ã³ã¹å¤æ°ã代ããã«ä½¿ç¨ããã¹ãã§ã::"
#: ../../tutorial/classes.rst:474
msgid "Random Remarks"
msgstr "ãããããªæ³¨æç¹"
#: ../../tutorial/classes.rst:478
msgid ""
"Data attributes override method attributes with the same name; to avoid "
"accidental name conflicts, which may cause hard-to-find bugs in large "
"programs, it is wise to use some kind of convention that minimizes the "
"chance of conflicts. Possible conventions include capitalizing method "
"names, prefixing data attribute names with a small unique string (perhaps "
"just an underscore), or using verbs for methods and nouns for data "
"attributes."
msgstr ""
"ãã¼ã¿å±æ§ã¯åãååã®ã¡ã½ãã屿§ã䏿¸ããã¦ãã¾ãã¾ããå¤§è¦æ¨¡ãªããã°ã©ã "
"ã§ã¿ã¤ãã«ãããã°ãå¼ãèµ·ãããã¨ããããã®å¶ç¶çãªååã®è¡çªãé¿ããã«ã¯ã"
"è¡çªã®å¯è½æ§ãæå°éã«ãããããªè¦ç´ã使ãã®ãè³¢æã§ããå¯è½ãªè¦ç´ã¨ãã¦ã¯ã"
"ã¡ã½ããåã大æåã§å§ããããã¼ã¿å±æ§åã®å
é ã«çãä¸æãªæåå (ãããã¯ã"
"ã ã®ä¸ç·) ãã¤ãããã¾ãã¡ã½ããã«ã¯åè©ããã¼ã¿å±æ§ã«ã¯åè©ãç¨ããããªã©ã"
"ããã¾ãã"
#: ../../tutorial/classes.rst:485
msgid ""
"Data attributes may be referenced by methods as well as by ordinary users "
"(\"clients\") of an object. In other words, classes are not usable to "
"implement pure abstract data types. In fact, nothing in Python makes it "
"possible to enforce data hiding --- it is all based upon convention. (On "
"the other hand, the Python implementation, written in C, can completely hide "
"implementation details and control access to an object if necessary; this "
"can be used by extensions to Python written in C.)"
msgstr ""
"ãã¼ã¿å±æ§ã¯ãã¡ã½ããããåç
§ã§ããã¨åæã«ãé常ã®ãªãã¸ã§ã¯ãã®ã¦ã¼ã¶ "
"(\"ã¯ã©ã¤ã¢ã³ã\") ãããåç
§ã§ãã¾ããè¨ãæããã¨ãã¯ã©ã¹ã¯ç´ç²ãªæ½è±¡ãã¼ã¿"
"åã¨ãã¦ä½¿ããã¨ãã§ãã¾ãããå®éã Python ã§ã¯ããã¼ã¿é è½ãè£å¼·ããããã®"
"æ©æ§ã¯ãªã«ãããã¾ãã --- ãã¼ã¿ã®é è½ã¯ãã¹ã¦è¦ç´ã«åºã¥ãã¦ãã¾ãã (éã«ã"
"C è¨èªã§æ¸ããã Python ã®å®è£
ã§ã¯å®è£
ã®è©³ç´°ãå®å
¨ã«é è½ããå¿
è¦ã«å¿ãã¦ãªã"
"ã¸ã§ã¯ãã¸ã®ã¢ã¯ã»ã¹ãå¶å¾¡ã§ãã¾ãããã®æ©æ§ã¯ C è¨èªã§æ¸ããã Python æ¡å¼µã§"
"使ããã¨ãã§ãã¾ãã)"
#: ../../tutorial/classes.rst:493
msgid ""
"Clients should use data attributes with care --- clients may mess up "
"invariants maintained by the methods by stamping on their data attributes. "
"Note that clients may add data attributes of their own to an instance object "
"without affecting the validity of the methods, as long as name conflicts are "
"avoided --- again, a naming convention can save a lot of headaches here."
msgstr ""
"ã¯ã©ã¤ã¢ã³ãã¯ãã¼ã¿å±æ§ãæ³¨ææ·±ãæ±ãã¹ãã§ã --- ã¯ã©ã¤ã¢ã³ãã¯ãã¡ã½ããã"
"ç¶æãã¦ãããã¼ã¿å±æ§ã®ä¸å¤å¼ãè¸ã¿ã«ãããå°ç¡ãã«ããããããã¾ãããã¯ã©"
"ã¤ã¢ã³ãã¯ãååã®è¡çªãåé¿ããã¦ããéããã¡ã½ããã®æå¹æ§ã«å½±é¿ãåã¼ãã"
"ã¨ãªãã¤ã³ã¹ã¿ã³ã¹ã«ç¬èªã®å±æ§ã追å ãããã¨ãã§ãããã¨ãããã¨ã«æ³¨æãã¦ã"
"ã ãã --- ããã§ããååä»ãã®è¦ç´ã¯é çã®ç¨®ãç¡ããã¦ããã¾ãã"
#: ../../tutorial/classes.rst:499
msgid ""
"There is no shorthand for referencing data attributes (or other methods!) "
"from within methods. I find that this actually increases the readability of "
"methods: there is no chance of confusing local variables and instance "
"variables when glancing through a method."
msgstr ""
"ã¡ã½ããã®ä¸ããããã¼ã¿å±æ§ã (ã¾ãã¯å¥ã®ã¡ã½ãããï¼) åç
§ããããã®ç縮ã"
"ããè¨æ³ã¯ããã¾ãããç§ã¯ããã®ä»æ§ãã¡ã½ããã®å¯èªæ§ãé«ãã¦ããã¨æãã¦ã"
"ã¾ããããã¡ã½ãããçºãã¦ããã¨ãã«ãã¼ã«ã«ãªå¤æ°ã¨ã¤ã³ã¹ã¿ã³ã¹å¤æ°ãã¯ã£ã"
"ãåºå¥ã§ããããã§ãã"
#: ../../tutorial/classes.rst:504
msgid ""
"Often, the first argument of a method is called ``self``. This is nothing "
"more than a convention: the name ``self`` has absolutely no special meaning "
"to Python. Note, however, that by not following the convention your code "
"may be less readable to other Python programmers, and it is also conceivable "
"that a *class browser* program might be written that relies upon such a "
"convention."
msgstr ""
"ãããã¡ã½ããã®æåã®å¼æ°ã ``self`` ã¨å¼ã³ã¾ãããã®ååä»ãã¯åãªãæ
£ç¿ã§"
"ããããã¾ããã ``self`` ã¨ããååã¯ã Python ã§ã¯ä½ãç¹æ®ãªæå³ãæã¡ã¾ã"
"ããã¨ã¯ããããã®æ
£è¡ã«å¾ããªãã¨ãã³ã¼ãã¯ä»ã® Python ããã°ã©ãã«ã¨ã£ã¦ã"
"ãèªã¿ã«ãããã®ã¨ãªãã¾ããã¾ãã *ã¯ã©ã¹ãã©ã¦ã¶ (class browser)* ããã°ã©"
"ã ããã®æ
£è¡ããã¦ã«ãã¦æ¸ããã¦ããããããã¾ããã"
#: ../../tutorial/classes.rst:510
msgid ""
"Any function object that is a class attribute defines a method for instances "
"of that class. It is not necessary that the function definition is "
"textually enclosed in the class definition: assigning a function object to a "
"local variable in the class is also ok. For example::"
msgstr ""
"ã¯ã©ã¹å±æ§ã§ãã颿°ãªãã¸ã§ã¯ãã¯ããããããã®ã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ã®ããã®"
"ã¡ã½ãããå®ç¾©ãã¦ãã¾ãã颿°å®ç¾©ã¯ãããã¹ãä¸ã§ã¯ã©ã¹å®ç¾©ã®ä¸ã«å
¥ã£ã¦ãã"
"å¿
è¦ã¯ããã¾ããã颿°ãªãã¸ã§ã¯ããã¯ã©ã¹ã®ãã¼ã«ã«ãªå¤æ°ã®ä¸ã«ä»£å
¥ããã®ã "
"OK ã§ããä¾ãã°ä»¥ä¸ã®ã³ã¼ãã®ããã«ãã¾ã::"
#: ../../tutorial/classes.rst:527
msgid ""
"Now ``f``, ``g`` and ``h`` are all attributes of class :class:`C` that refer "
"to function objects, and consequently they are all methods of instances of :"
"class:`C` --- ``h`` being exactly equivalent to ``g``. Note that this "
"practice usually only serves to confuse the reader of a program."
msgstr ""
"ããã§ã ``f`` ã ``g`` ãããã³ ``h`` ã¯ããã¹ã¦ :class:`C` ã®å±æ§ã§ãã颿°"
"ãªãã¸ã§ã¯ããåç
§ãã¦ãã¾ããå¾ã£ã¦ããããå
¨ã¦ã¯ã :class:`C` ã®ã¤ã³ã¹ã¿ã³"
"ã¹ã®ã¡ã½ããã¨ãªãã¾ã --- ``h`` 㯠``g`` ã¨å
¨ãç価ã§ãããããå®è·µãã¦ãã"
"大æµã¯åã«ããã°ã©ã ã®èªè
ã«æ··ä¹±ãããããã ããªã®ã§æ³¨æãã¦ãã ããã"
#: ../../tutorial/classes.rst:532
msgid ""
"Methods may call other methods by using method attributes of the ``self`` "
"argument::"
msgstr ""
"ã¡ã½ããã¯ã ``self`` 弿°ã®ã¡ã½ãã屿§ã使ã£ã¦ãä»ã®ã¡ã½ãããå¼ã³åºããã¨"
"ãã§ãã¾ã::"
#: ../../tutorial/classes.rst:546
msgid ""
"Methods may reference global names in the same way as ordinary functions. "
"The global scope associated with a method is the module containing its "
"definition. (A class is never used as a global scope.) While one rarely "
"encounters a good reason for using global data in a method, there are many "
"legitimate uses of the global scope: for one thing, functions and modules "
"imported into the global scope can be used by methods, as well as functions "
"and classes defined in it. Usually, the class containing the method is "
"itself defined in this global scope, and in the next section we'll find some "
"good reasons why a method would want to reference its own class."
msgstr ""
"ã¡ã½ããã¯ãé常ã®é¢æ°ã¨åãããã«ãã¦ã°ãã¼ãã«ãªååãåç
§ãã¾ããããã¡"
"ã½ããã«é¢ããã°ãã¼ãã«ã¹ã³ã¼ãã¯ããã®å®ç¾©ãå«ãã¢ã¸ã¥ã¼ã«ã§ãã(ã¯ã©ã¹ã¯ã°"
"ãã¼ãã«ãªã¹ã³ã¼ãã¨ãã¦ç¨ãããããã¨ã¯ããã¾ããã) ã¡ã½ããã§ã°ãã¼ãã«ãª"
"ãã¼ã¿ã使ãè¯ãçç±ã¯ã»ã¨ãã©ããã¾ããããã°ãã¼ãã«ãªã¹ã³ã¼ãã使ãã¹ãå ´"
"é¢ã¯å¤ã
ããã¾ããä¸ã¤æããã¨ãã¡ã½ããå
ãããã°ãã¼ãã«ãªã¹ã³ã¼ãã« "
"import ããã颿°ãã¢ã¸ã¥ã¼ã«ãããã®ã¢ã¸ã¥ã¼ã«ä¸ã§å®ç¾©ããã颿°ãã¯ã©ã¹ã使"
"ããã¨ãã§ãã¾ããé常ãã¡ã½ããã®å
¥ã£ã¦ããã¯ã©ã¹èªä½ã¯ã°ãã¼ãã«ãªã¹ã³ã¼ã"
"å
ã§å®ç¾©ããã¦ãã¾ããæ¬¡ã®ç¯ã§ã¯ãã¡ã½ãããèªåã®ã¯ã©ã¹ãåç
§ããçç±ã¨ãã¦"
"æ£å½ãªãã®ãè¦ã¦ã¿ã¾ãããã"
#: ../../tutorial/classes.rst:556
msgid ""
"Each value is an object, and therefore has a *class* (also called its "
"*type*). It is stored as ``object.__class__``."
msgstr ""
"åã
ã®å¤ã¯ãªãã¸ã§ã¯ããªã®ã§ã *ã¯ã©ã¹* (*å* ã¨ãè¨ãã¾ã) ãæã£ã¦ãã¾ãã"
"ãã㯠``object.__class__`` ã«ä¿æããã¦ãã¾ãã"
#: ../../tutorial/classes.rst:563
msgid "Inheritance"
msgstr "ç¶æ¿"
#: ../../tutorial/classes.rst:565
msgid ""
"Of course, a language feature would not be worthy of the name \"class\" "
"without supporting inheritance. The syntax for a derived class definition "
"looks like this::"
msgstr ""
"è¨ãã¾ã§ããªããç¶æ¿ã®æ¦å¿µããµãã¼ãããªãè¨èªæ©è½ã¯ \"ã¯ã©ã¹\" ã¨å¼ã¶ã«å¤ã"
"ã¾ãããæ´¾çã¯ã©ã¹ (derived class) ãå®ç¾©ããæ§æã¯æ¬¡ã®ããã«ãªãã¾ã::"
#: ../../tutorial/classes.rst:576
msgid ""
"The name :class:`BaseClassName` must be defined in a scope containing the "
"derived class definition. In place of a base class name, other arbitrary "
"expressions are also allowed. This can be useful, for example, when the "
"base class is defined in another module::"
msgstr ""
"åºåºã¯ã©ã¹ (base class) ã®åå :class:`BaseClassName` ã¯ãæ´¾çã¯ã©ã¹å®ç¾©ã®"
"å
¥ã£ã¦ããã¹ã³ã¼ãã§å®ç¾©ããã¦ããªããã°ãªãã¾ãããåºåºã¯ã©ã¹åã®ãããã«ä»»"
"æã®å¼ãå
¥ãããã¨ãã§ãã¾ããããã¯æ¬¡ã®ä¾ã®ããã«ãåºåºã¯ã©ã¹ãå¥ã¢ã¸ã¥ã¼ã«"
"ã§å®ç¾©ããã¦ããã¨ãã«ä¾¿å©ãªãã¨ãããã¾ã::"
#: ../../tutorial/classes.rst:583
msgid ""
"Execution of a derived class definition proceeds the same as for a base "
"class. When the class object is constructed, the base class is remembered. "
"This is used for resolving attribute references: if a requested attribute is "
"not found in the class, the search proceeds to look in the base class. This "
"rule is applied recursively if the base class itself is derived from some "
"other class."
msgstr ""
"æ´¾çã¯ã©ã¹å®ç¾©ã®å®è¡ã¯ãåºåºã¯ã©ã¹ã®å ´åã¨åãããã«é²ãããã¾ããã¯ã©ã¹ãªã"
"ã¸ã§ã¯ããæ§ç¯ãããæãåºåºã¯ã©ã¹ãè¨æ¶ããã¾ããè¨æ¶ãããåºåºã¯ã©ã¹ã¯ãå±"
"æ§åç
§ã解決ããããã«ä½¿ããã¾ããè¦æ±ããã屿§ãã¯ã©ã¹ã«è¦ã¤ãããªãã£ãå ´"
"åãåºåºã¯ã©ã¹ã«æ¤ç´¢ãé²ã¿ã¾ãããã®è¦åã¯ãåºåºã¯ã©ã¹ãä»ã®ä½ããã®ã¯ã©ã¹ã"
"ãæ´¾çãããã®ã§ãã£ãå ´åãå帰çã«é©ç¨ããã¾ãã"
#: ../../tutorial/classes.rst:589
msgid ""
"There's nothing special about instantiation of derived classes: "
"``DerivedClassName()`` creates a new instance of the class. Method "
"references are resolved as follows: the corresponding class attribute is "
"searched, descending down the chain of base classes if necessary, and the "
"method reference is valid if this yields a function object."
msgstr ""
"æ´¾çã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹åã§ã¯ãç¹å¥ãªãã¨ã¯ä½ãããã¾ããã "
"``DerivedClassName()`` ã¯ã¯ã©ã¹ã®æ°ããªã¤ã³ã¹ã¿ã³ã¹ãçæãã¾ããã¡ã½ããã®å"
"ç
§ã¯æ¬¡ã®ããã«ãã¦è§£æ±ºããã¾ããã¾ã対å¿ããã¯ã©ã¹å±æ§ãæ¤ç´¢ããã¾ããæ¤ç´¢"
"ã¯ãå¿
è¦ã«å¿ããåºåºã¯ã©ã¹é£éãä¸ã£ã¦è¡ãããæ¤ç´¢ã®çµæã¨ãã¦ä½ããã®é¢æ°ãª"
"ãã¸ã§ã¯ããããããããå ´åãã¡ã½ããåç
§ã¯æå¹ãªãã®ã¨ãªãã¾ãã"
#: ../../tutorial/classes.rst:595
msgid ""
"Derived classes may override methods of their base classes. Because methods "
"have no special privileges when calling other methods of the same object, a "
"method of a base class that calls another method defined in the same base "
"class may end up calling a method of a derived class that overrides it. "
"(For C++ programmers: all methods in Python are effectively ``virtual``.)"
msgstr ""
"æ´¾çã¯ã©ã¹ã¯åºåºã¯ã©ã¹ã®ã¡ã½ããã䏿¸ã (override) ãããã¨ãã§ãã¾ããã¡"
"ã½ããã¯åããªãã¸ã§ã¯ãã®å¥ã®ã¡ã½ãããå¼ã³åºãéã«ä½ãç¹æ®ãªæ¨©éãæã¡ã¾ã"
"ãããã®ãããããåºåºã¯ã©ã¹ã®ã¡ã½ããããåãåºåºã¯ã©ã¹ã§å®ç¾©ããã¦ãããã"
"ä¸ã¤ã®ã¡ã½ããå¼ã³åºããè¡ã£ã¦ããå ´åãæ´¾çã¯ã©ã¹ã§ä¸æ¸ããããä½ããã®ã¡"
"ã½ãããå¼ã³åºããããã¨ã«ãªãããããã¾ããã (C++ ããã°ã©ãã¸: Python ã§"
"ã¯ããã¹ã¦ã®ã¡ã½ããã¯äºå®ä¸ ``virtual`` ã§ãã)"
#: ../../tutorial/classes.rst:601
msgid ""
"An overriding method in a derived class may in fact want to extend rather "
"than simply replace the base class method of the same name. There is a "
"simple way to call the base class method directly: just call ``BaseClassName."
"methodname(self, arguments)``. This is occasionally useful to clients as "
"well. (Note that this only works if the base class is accessible as "
"``BaseClassName`` in the global scope.)"
msgstr ""
"æ´¾çã¯ã©ã¹ã§ä¸æ¸ããã¦ããã¡ã½ããã§ã¯ãåºåºã¯ã©ã¹ã®ååã®ã¡ã½ãããç½®ãæã"
"ãã®ã§ã¯ãªããæ¡å¼µãããã®ããããã¾ãããåºåºã¯ã©ã¹ã®ã¡ã½ãããç´æ¥å¼ã³åºã"
"ç°¡åãªæ¹æ³ãããã¾ããåã« ``BaseClassName.methodname(self, arguments)`` ãå¼"
"ã³åºãã ãã§ãããã®ä»æ§ã¯ãå ´åã«ãã£ã¦ã¯ã¯ã©ã¤ã¢ã³ãã§ãå½¹ã«ç«ã¡ã¾ãã (ã"
"ã®å¼ã³åºãæ¹ãåä½ããã®ã¯ãåºåºã¯ã©ã¹ãã°ãã¼ãã«ã¹ã³ã¼ãã® "
"``BaseClassName`` ã¨ããååã§ã¢ã¯ã»ã¹ã§ããã¨ãã ãã§ãã)"
#: ../../tutorial/classes.rst:608
msgid "Python has two built-in functions that work with inheritance:"
msgstr "Python ã«ã¯ç¶æ¿ã«é¢ä¿ãã 2 ã¤ã®çµã¿è¾¼ã¿é¢æ°ãããã¾ã:"
#: ../../tutorial/classes.rst:610
msgid ""
"Use :func:`isinstance` to check an instance's type: ``isinstance(obj, int)`` "
"will be ``True`` only if ``obj.__class__`` is :class:`int` or some class "
"derived from :class:`int`."
msgstr ""
":func:`isinstance` ã使ãã¨ã¤ã³ã¹ã¿ã³ã¹ã®åã調ã¹ããã¾ãã "
"``isinstance(obj, int)`` 㯠``obj.__class__`` ã :class:`int` ã :class:"
"`int` ã®æ´¾çã¯ã©ã¹ã®å ´åã«éã ``True`` ã«ãªãã¾ãã"
#: ../../tutorial/classes.rst:614
msgid ""
"Use :func:`issubclass` to check class inheritance: ``issubclass(bool, int)`` "
"is ``True`` since :class:`bool` is a subclass of :class:`int`. However, "
"``issubclass(float, int)`` is ``False`` since :class:`float` is not a "
"subclass of :class:`int`."
msgstr ""
":func:`issubclass` ã使ãã¨ã¯ã©ã¹ã®ç¶æ¿é¢ä¿ã調ã¹ããã¾ãã :class:`bool` "
"㯠:class:`int` ã®ãµãã¯ã©ã¹ãªã®ã§ ``issubclass(bool, int)`` 㯠``True`` ã§"
"ãããããã :class:`float` 㯠:class:`int` ã®ãµãã¯ã©ã¹ã§ã¯ãªãã®ã§ "
"``issubclass(float, int)`` 㯠``False`` ã§ãã"
#: ../../tutorial/classes.rst:624
msgid "Multiple Inheritance"
msgstr "å¤éç¶æ¿"
#: ../../tutorial/classes.rst:626
msgid ""
"Python supports a form of multiple inheritance as well. A class definition "
"with multiple base classes looks like this::"
msgstr ""
"Python ã§ã¯ãå¤éç¶æ¿ (multiple inheritance) ã®å½¢å¼ããµãã¼ããã¦ãã¾ããè¤æ°"
"ã®åºåºã¯ã©ã¹ããã¤ã¯ã©ã¹å®ç¾©ã¯æ¬¡ã®ããã«ãªãã¾ã::"
#: ../../tutorial/classes.rst:636
msgid ""
"For most purposes, in the simplest cases, you can think of the search for "
"attributes inherited from a parent class as depth-first, left-to-right, not "
"searching twice in the same class where there is an overlap in the "
"hierarchy. Thus, if an attribute is not found in :class:`DerivedClassName`, "
"it is searched for in :class:`Base1`, then (recursively) in the base classes "
"of :class:`Base1`, and if it was not found there, it was searched for in :"
"class:`Base2`, and so on."
msgstr ""
"ã»ã¨ãã©ã®ã·ã³ãã«ãªå¤éç¶æ¿ã«ããã¦ã親ã¯ã©ã¹ããç¶æ¿ããã屿§ã®æ¤ç´¢ã¯ãæ·±"
"ãåªå
ã§ãå·¦ããå³ã«ãããã¦ç¶æ¿ã®é層ã®ä¸ã§åãã¯ã©ã¹ãè¤æ°åºã¦ããï¼è¨³æ³¨: "
"ãã¤ã¢ã¢ã³ãç¶æ¿ã¨å¼ã°ãã¾ãï¼å ´åã«ï¼åº¦æ¢ç´¢ãããªããã¨èãããã¨ãã§ãã¾"
"ãããªã®ã§ã :class:`DerivedClassName` ã«ãã屿§ãåå¨ããªãå ´åãã¾ã :"
"class:`Base1` ããæ¤ç´¢ãããããã¦ï¼å帰çã«ï¼ :class:`Base1` ã®åºåºã¯ã©ã¹ã"
"ãæ¤ç´¢ãããããã§ãè¦ã¤ãããªãã£ãå ´å㯠:class:`Base2` ããæ¤ç´¢ããããã¨"
"ãã£ãå
·åã«ãªãã¾ãã"
#: ../../tutorial/classes.rst:643
msgid ""
"In fact, it is slightly more complex than that; the method resolution order "
"changes dynamically to support cooperative calls to :func:`super`. This "
"approach is known in some other multiple-inheritance languages as call-next-"
"method and is more powerful than the super call found in single-inheritance "
"languages."
msgstr ""
"å®éã«ã¯ãããããããå°ãã ãè¤éã§ããå調ç㪠:func:`super` ã®å¼ã³åºãã®ã"
"ãã«ã¡ã½ããã®è§£æ±ºé åºã¯åçã«å¤æ´ããã¾ãããã®ã¢ããã¼ãã¯ä»ã®å¤éç¶æ¿ã®ã"
"ãè¨èªã§ call-next-method ã¨ãã¦ç¥ããã¦ãããåä¸ç¶æ¿ãããªãè¨èªã® super å¼"
"ã³åºããããå¼·åã§ãã"
#: ../../tutorial/classes.rst:649
msgid ""
"Dynamic ordering is necessary because all cases of multiple inheritance "
"exhibit one or more diamond relationships (where at least one of the parent "
"classes can be accessed through multiple paths from the bottommost class). "
"For example, all classes inherit from :class:`object`, so any case of "
"multiple inheritance provides more than one path to reach :class:`object`. "
"To keep the base classes from being accessed more than once, the dynamic "
"algorithm linearizes the search order in a way that preserves the left-to-"
"right ordering specified in each class, that calls each parent only once, "
"and that is monotonic (meaning that a class can be subclassed without "
"affecting the precedence order of its parents). Taken together, these "
"properties make it possible to design reliable and extensible classes with "
"multiple inheritance. For more detail, see https://www.python.org/download/"
"releases/2.3/mro/."
msgstr ""
"å¤éç¶æ¿ã®å
¨ã¦ã®å ´åã« 1 ã¤ããã以ä¸ã®ãã¤ã¤ã¢ã³ãç¶æ¿ (å°ãªãã¨ã 1 ã¤ã®ç¥"
"å
ã¯ã©ã¹ã«å¯¾ãæãä¸ã®ã¯ã©ã¹ããå°éããçµè·¯ãè¤æ°ããç¶æ
) ãããã®ã§ãåç"
"é åºä»ããå¿
è¦ã§ããä¾ãã°ãå
¨ã¦ã®æ°å½¢å¼ã®ã¯ã©ã¹ã¯ :class:`object` ãç¶æ¿ãã¦"
"ããã®ã§ãã©ã®å¤éç¶æ¿ã§ã :class:`object` ã¸å°éããããã®éã¯è¤æ°åå¨ãã¾"
"ããåºåºã¯ã©ã¹ãè¤æ°åã¢ã¯ã»ã¹ãããªãããã«ããããã«ãåçã¢ã«ã´ãªãºã ã§æ¤"
"ç´¢é åºãç´ååããåã¯ã©ã¹ã§æå®ããã¦ããç¥å
ã¯ã©ã¹ã©ããã®å·¦ããå³ã¸ã®é åº"
"ã¯å´©ãããåç¥å
ã¯ã©ã¹ãä¸åº¦ã ãå¼ã³åºãããã¤ä¸æ§ã«ãªã (ã¤ã¾ãç¥å
ã¯ã©ã¹ã®"
"é åºã«å½±é¿ãä¸ããã«ãµãã¯ã©ã¹åã§ãã) ããã«ãã¾ããã¾ã¨ããã¨ããããã®ç¹"
"å¾´ã®ãããã§ä¿¡é ¼æ§ã¨æ¡å¼µæ§ã®ããå¤éç¶æ¿ããã¯ã©ã¹ãè¨è¨ãããã¨ãã§ããã®ã§"
"ããããã«è©³ç´°ãç¥ããããã°ã https://www.python.org/download/releases/2.3/"
"mro/ ãè¦ã¦ãã ããã"
#: ../../tutorial/classes.rst:666
msgid "Private Variables"
msgstr "ãã©ã¤ãã¼ã夿°"
#: ../../tutorial/classes.rst:668
msgid ""
"\"Private\" instance variables that cannot be accessed except from inside an "
"object don't exist in Python. However, there is a convention that is "
"followed by most Python code: a name prefixed with an underscore (e.g. "
"``_spam``) should be treated as a non-public part of the API (whether it is "
"a function, a method or a data member). It should be considered an "
"implementation detail and subject to change without notice."
msgstr ""
"ãªãã¸ã§ã¯ãã®ä¸ããããã¢ã¯ã»ã¹åºæ¥ãªã \"ãã©ã¤ãã¼ã\" ã¤ã³ã¹ã¿ã³ã¹å¤æ°"
"ã¯ã Python ã«ã¯ããã¾ãããããããã»ã¨ãã©ã® Python ã³ã¼ããå¾ã£ã¦ããæ
£ç¿"
"ãããã¾ããã¢ã³ãã¼ã¹ã³ã¢ã§å§ã¾ãåå (ä¾ãã° ``_spam``) ã¯ã (颿°ã§ããã¡"
"ã½ããã§ãããã¼ã¿ã¡ã³ãã§ãã) é public ãªAPIã¨ãã¦æ±ãã¾ãããããã¯ãäºå"
"ãªã夿´ããããããããªãå®è£
ã®è©³ç´°ã¨ãã¦æ±ãããã¹ãã§ãã"
#: ../../tutorial/classes.rst:678
msgid ""
"Since there is a valid use-case for class-private members (namely to avoid "
"name clashes of names with names defined by subclasses), there is limited "
"support for such a mechanism, called :dfn:`name mangling`. Any identifier "
"of the form ``__spam`` (at least two leading underscores, at most one "
"trailing underscore) is textually replaced with ``_classname__spam``, where "
"``classname`` is the current class name with leading underscore(s) "
"stripped. This mangling is done without regard to the syntactic position of "
"the identifier, as long as it occurs within the definition of a class."
msgstr ""
"ã¯ã©ã¹ã®ãã©ã¤ãã¼ãã¡ã³ãã«ã¤ãã¦é©åãªã¦ã¼ã¹ã±ã¼ã¹(ç¹ã«ãµãã¯ã©ã¹ã§å®ç¾©ãã"
"ãååã¨ã®è¡çªãé¿ããå ´å)ãããã®ã§ãååãã³ã°ãªã³ã° (:dfn:`name "
"mangling`) ã¨å¼ã°ãããéå®ããããµãã¼ãæ©æ§ãããã¾ãã ``__spam`` (å
é ã«"
"äºå以ä¸ã®ä¸ç·æåãæ«å°¾ã«ä¸å以ä¸ã®ä¸ç·æå) ã¨ããå½¢å¼ã®èå¥åã¯ã "
"``_classname__spam`` ã¸ã¨ããã¹ãç½®æãããããã«ãªãã¾ãããããã§ "
"``classname`` ã¯ãç¾å¨ã®ã¯ã©ã¹åããå
é ã®ä¸ç·æåãã¯ãã¨ã£ãååã«ãªãã¾"
"ãããã®ãããªé£å·å (mangle) ã¯ãèå¥åã®ææ³çãªä½ç½®ã«ãããããè¡ãããã®"
"ã§ãã¯ã©ã¹å®ç¾©å
ã«ç¾ããèå¥åå
¨ã¦ã«å¯¾ãã¦å®è¡ããã¾ãã"
#: ../../tutorial/classes.rst:687
msgid ""
"Name mangling is helpful for letting subclasses override methods without "
"breaking intraclass method calls. For example::"
msgstr ""
"ååãã³ã°ãªã³ã°ã¯ããµãã¯ã©ã¹ãå
é¨ã®ã¡ã½ããå¼ã³åºããå£ããã«ã¡ã½ããã"
"ãªã¼ãã¼ã©ã¤ãããã®ã«ä¾¿å©ã§ããä¾ãã°::"
#: ../../tutorial/classes.rst:709
msgid ""
"The above example would work even if ``MappingSubclass`` were to introduce a "
"``__update`` identifier since it is replaced with ``_Mapping__update`` in "
"the ``Mapping`` class and ``_MappingSubclass__update`` in the "
"``MappingSubclass`` class respectively."
msgstr ""
"ä¸ã®ä¾ã¯ããã仮㫠``MappingSubclass`` ã« ``__update`` èå¥åãå®è£
ããã¨ãã¦"
"ããã¡ãã¨åãã¾ãã\n"
"ãã®çç±ã¯ã ``Mapping`` ã¯ã©ã¹ã§ã¯ãã®èå¥åã ``_Mapping__update`` ã«ã "
"``MappingSubclass`` ã¯ã©ã¹ã§ã¯ ``_MappingSubclass__update`` ã«ããããç½®ãæ"
"ããããã§ãã"
#: ../../tutorial/classes.rst:714
msgid ""
"Note that the mangling rules are designed mostly to avoid accidents; it "
"still is possible to access or modify a variable that is considered "
"private. This can even be useful in special circumstances, such as in the "
"debugger."
msgstr ""
"é£å·åã®è¦åã¯ä¸»ã«ä¸æ
®ã®äºæ
ãé²ãããã®ãã®ã ã¨ãããã¨ã«æ³¨æãã¦ãã ãã; "
"確信ç¯çãªæ¹æ³ã§ããã©ã¤ãã¼ãã¨ããã¦ãã夿°ã«ã¢ã¯ã»ã¹ããã夿´ãããã¨ã¯"
"ä¾ç¶ã¨ãã¦å¯è½ãªã®ã§ãããããã¬ã®ãããªç¹æ®ãªç¶æ³ã§ã¯ããã®ä»æ§ã¯ä¾¿å©ã§ãã"
"ããã¾ãã"
#: ../../tutorial/classes.rst:718
msgid ""
"Notice that code passed to ``exec()`` or ``eval()`` does not consider the "
"classname of the invoking class to be the current class; this is similar to "
"the effect of the ``global`` statement, the effect of which is likewise "
"restricted to code that is byte-compiled together. The same restriction "
"applies to ``getattr()``, ``setattr()`` and ``delattr()``, as well as when "
"referencing ``__dict__`` directly."
msgstr ""
"``exec()`` ã ``eval()`` ã¸æ¸¡ãããã³ã¼ãã§ã¯ãå¼åºãå
ã®ã¯ã©ã¹åãç¾å¨ã®ã¯ã©"
"ã¹ã¨è¦ãªããªããã¨ã«æ³¨æãã¦ãã ããããã®ä»æ§ã¯ ``global`` æã®å¹æã¨ä¼¼ã¦ã"
"ãããã®å¹æãã¾ãåæ§ã«ããã¤ãã³ã³ãã¤ã«ãããã³ã¼ãã«å¶éããã¦ãã¾ããå"
"ãå¶ç´ã ``getattr()`` 㨠``setattr()`` 㨠``delattr()`` ã«ãé©ç¨ããã¾ããã¾"
"ãã``__dict__`` ãç´æ¥åç
§ããã¨ãã«ãé©ç¨ããã¾ãã"
#: ../../tutorial/classes.rst:729
msgid "Odds and Ends"
msgstr "æ®ãã®ã¯ãã°ã"
#: ../../tutorial/classes.rst:731
msgid ""
"Sometimes it is useful to have a data type similar to the Pascal \"record\" "
"or C \"struct\", bundling together a few named data items. An empty class "
"definition will do nicely::"
msgstr ""
"Pascal ã® \"ã¬ã³ã¼ã (record)\" ããC è¨èªã® \"æ§é ä½ (struct)\" ã®ãããªãå"
"åã¤ãã®ãã¼ã¿è¦ç´ ãä¸ã¾ã¨ãã«ãããã¼ã¿åãããã¨ä¾¿å©ãªãã¨ãããã¾ãã空ã®"
"ã¯ã©ã¹å®ç¾©ã使ãã¨ãã¾ãã§ãã¾ã::"
#: ../../tutorial/classes.rst:745
msgid ""
"A piece of Python code that expects a particular abstract data type can "
"often be passed a class that emulates the methods of that data type "
"instead. For instance, if you have a function that formats some data from a "
"file object, you can define a class with methods :meth:`read` and :meth:`!"
"readline` that get the data from a string buffer instead, and pass it as an "
"argument."
msgstr ""
"ããç¹å®ã®æ½è±¡ãã¼ã¿åãè¦æ±ãã Python ã³ã¼ãã®æçã«ããã®ãã¼ã¿åã®ã¡ã½ã"
"ããã¨ãã¥ã¬ã¼ã·ã§ã³ããã¯ã©ã¹ã代ããã«æ¸¡ããã¨ãã§ãã¾ããä¾ãã°ããã¡ã¤ã«"
"ãªãã¸ã§ã¯ãããä½ããã®ãã¼ã¿ãæ§ç¯ãã颿°ãããå ´åã :meth:`read` 㨠:"
"meth:`!readline` ãæã¤ã¯ã©ã¹ãå®ç¾©ãã¦ããã¡ã¤ã«ã§ã¯ãªãæååãããã¡ãã"
"ãã¼ã¿ãåå¾ããããã«ãã¦ããã弿°ã¨ãã¦æ¸¡ããã¨ãã§ãã¾ãã"
#: ../../tutorial/classes.rst:756
msgid ""
"Instance method objects have attributes, too: ``m.__self__`` is the instance "
"object with the method :meth:`m`, and ``m.__func__`` is the function object "
"corresponding to the method."
msgstr ""
"ã¤ã³ã¹ã¿ã³ã¹ã¡ã½ãããªãã¸ã§ã¯ãã«ã屿§ãããã¾ãã ``m.__self__`` ã¯ã¡ã½ã"
"ã :meth:`m` ã®å±ãã¦ããã¤ã³ã¹ã¿ã³ã¹ãªãã¸ã§ã¯ãã§ã ``m.__func__`` ã¯ã¡ã½ã"
"ãã«å¯¾å¿ãã颿°ãªãã¸ã§ã¯ãã§ãã"
#: ../../tutorial/classes.rst:764
msgid "Iterators"
msgstr "ã¤ãã¬ã¼ã¿ (iterator)"
#: ../../tutorial/classes.rst:766
msgid ""
"By now you have probably noticed that most container objects can be looped "
"over using a :keyword:`for` statement::"
msgstr ""
"ãã§ã«æ°ã¥ãã¦ããã§ããããã :keyword:`for` æã使ãã¨ã»ã¨ãã©ã®ã³ã³ãããª"
"ãã¸ã§ã¯ãã«ããã£ã¦ã«ã¼ããè¡ããã¨ãã§ãã¾ã::"
#: ../../tutorial/classes.rst:780
msgid ""
"This style of access is clear, concise, and convenient. The use of "
"iterators pervades and unifies Python. Behind the scenes, the :keyword:"
"`for` statement calls :func:`iter` on the container object. The function "
"returns an iterator object that defines the method :meth:`~iterator."
"__next__` which accesses elements in the container one at a time. When "
"there are no more elements, :meth:`~iterator.__next__` raises a :exc:"
"`StopIteration` exception which tells the :keyword:`!for` loop to "
"terminate. You can call the :meth:`~iterator.__next__` method using the :"
"func:`next` built-in function; this example shows how it all works::"
msgstr ""
"ããããè¦ç´ ã¸ã®ã¢ã¯ã»ã¹æ¹æ³ã¯æç¢ºã§ç°¡æ½ã§ä½¿ãæããã®ã§ããã¤ãã¬ã¼ã¿ã®æ´»ç¨"
"㯠Python ã¸åºãè¡ã渡ããçµ±ä¸æãæããã¦ãã¾ããè£ã§ã¯ :keyword:`!for` æã¯"
"ã³ã³ãããªãã¸ã§ã¯ãã«å¯¾ã㦠:func:`iter` 颿°ãå¼ãã§ãã¾ãã颿°ã¯ãã³ã³ã"
"ãã®ä¸ã®è¦ç´ ã«1ã¤ãã¤ã¢ã¯ã»ã¹ãã :meth:`~iterator.__next__` ã¡ã½ãããå®ç¾©ã"
"ãã¦ããã¤ãã¬ã¼ã¿ãªãã¸ã§ã¯ããè¿ãã¾ãããã以ä¸è¦ç´ ãç¡ãå ´åã¯ã :meth:"
"`~iterator.__next__` ã¡ã½ãã㯠:exc:`StopIteration` ä¾å¤ãéåºãããã®éç¥ã"
"åã :keyword:`for` ã«ã¼ãã¯çµäºãã¾ããçµã¿è¾¼ã¿ã® :func:`next` 颿°ã使ã£"
"㦠:meth:`~iterator.__next__` ã¡ã½ãããç´æ¥å¼ã¶ãã¨ãã§ãã¾ã; ãã®ä¾ã¯é¢æ°"
"ãã©ãåãã®ãã示ãã¦ãã¾ã::"
#: ../../tutorial/classes.rst:805
msgid ""
"Having seen the mechanics behind the iterator protocol, it is easy to add "
"iterator behavior to your classes. Define an :meth:`__iter__` method which "
"returns an object with a :meth:`~iterator.__next__` method. If the class "
"defines :meth:`__next__`, then :meth:`__iter__` can just return ``self``::"
msgstr ""
"ã¤ãã¬ã¼ã¿ãããã³ã«ã®è£ã«ããä»çµã¿ã観å¯ãã¦ããã°ãèªä½ã®ã¯ã©ã¹ã«ã¤ãã¬ã¼"
"ã¿ã¨ãã¦ã®æ¯èãã追å ããã®ã¯ç°¡åã§ãã :meth:`~iterator.__next__` ã¡ã½ãã"
"ãæã¤ãªãã¸ã§ã¯ããè¿ã :meth:`__iter__` ã¡ã½ãããå®ç¾©ããã®ã§ããã¯ã©ã¹"
"ã :meth:`__next__` ã¡ã½ãããå®ç¾©ãã¦ããå ´åã :meth:`__iter__` ã¡ã½ããã¯"
"åã« ``self`` ãè¿ããã¨ãå¯è½ã§ã::"
#: ../../tutorial/classes.rst:842
msgid "Generators"
msgstr "ã¸ã§ãã¬ã¼ã¿ (generator)"
#: ../../tutorial/classes.rst:844
msgid ""
":term:`Generator`\\s are a simple and powerful tool for creating iterators. "
"They are written like regular functions but use the :keyword:`yield` "
"statement whenever they want to return data. Each time :func:`next` is "
"called on it, the generator resumes where it left off (it remembers all the "
"data values and which statement was last executed). An example shows that "
"generators can be trivially easy to create::"
msgstr ""
":term:`ã¸ã§ãã¬ã¼ã¿ ` ã¯ãã¤ãã¬ã¼ã¿ã使ããããã®ç°¡æ½ã§å¼·åãª"
"ãã¼ã«ã§ããã¸ã§ãã¬ã¼ã¿ã¯é常ã®é¢æ°ã®ããã«æ¸ããã¾ãããä½ããã®ãã¼ã¿ãè¿"
"ãã¨ãã«ã¯ :keyword:`yield` æã使ãã¾ãããã®ã¸ã§ãã¬ã¼ã¿ã«å¯¾ã㦠:func:"
"`next` ãå¼ã³åºããããã³ã«ãã¸ã§ãã¬ã¼ã¿ã¯ä»¥åã«ä¸æããå¦çãåéãã¾ã "
"(ã¸ã§ãã¬ã¼ã¿ã¯ãå
¨ã¦ã®ãã¼ã¿å¤ã¨æå¾ã«ã©ã®æãå®è¡ãããããè¨æ¶ãã¦ãã¾"
"ã)ã以ä¸ã®ä¾ãè¦ãã°ãã¸ã§ãã¬ã¼ã¿ãã¨ã¦ãç°¡åã«ä½æã§ãããã¨ããããã¾ã::"
#: ../../tutorial/classes.rst:865
msgid ""
"Anything that can be done with generators can also be done with class-based "
"iterators as described in the previous section. What makes generators so "
"compact is that the :meth:`__iter__` and :meth:`~generator.__next__` methods "
"are created automatically."
msgstr ""
"ã¸ã§ãã¬ã¼ã¿ã§ã§ãããã¨ã¯ãåã®ç¯ã§è§£èª¬ããã¯ã©ã¹ã使ã£ãã¤ãã¬ã¼ã¿ã§ãå®ç¾"
"ã§ãã¾ããã¸ã§ãã¬ã¼ã¿ã®å®ç¾©ãã³ã³ãã¯ãã«ãªãã®ã¯ :meth:`__iter__` ã¡ã½ãã"
"㨠:meth:`~generator.__next__` ã¡ã½ãããèªåã§ä½æãããããã§ãã"
#: ../../tutorial/classes.rst:870
msgid ""
"Another key feature is that the local variables and execution state are "
"automatically saved between calls. This made the function easier to write "
"and much more clear than an approach using instance variables like ``self."
"index`` and ``self.data``."
msgstr ""
"ã¸ã§ãã¬ã¼ã¿ã®ããä¸ã¤ã®éè¦ãªæ©è½ã¯ãå¼ã³åºããã¨ã«ãã¼ã«ã«å¤æ°ã¨å®è¡ç¶æ
ã"
"èªåçã«ä¿åãããã¨ãããã¨ã§ããããã«ããã ``self.index`` ã ``self."
"data`` ã¨ãã£ãã¤ã³ã¹ã¿ã³ã¹å¤æ°ã使ã£ãã¢ããã¼ããããç°¡åã«é¢æ°ãæ¸ããã¨ã"
"ã§ããããã«ãªãã¾ãã"
#: ../../tutorial/classes.rst:875
msgid ""
"In addition to automatic method creation and saving program state, when "
"generators terminate, they automatically raise :exc:`StopIteration`. In "
"combination, these features make it easy to create iterators with no more "
"effort than writing a regular function."
msgstr ""
"ã¡ã½ãããèªåçæãããããã°ã©ã ã®å®è¡ç¶æ
ãèªåä¿åããã»ãã«ãã¸ã§ãã¬ã¼"
"ã¿ã¯çµäºæã«èªåçã« :exc:`StopIteration` ãéåºãã¾ãããããã®æ©è½ãçµã¿å"
"ãããã¨ãé常ã®é¢æ°ãæ¸ãã®ã¨åãå´åã§ãç°¡åã«ã¤ãã¬ã¼ã¿ãçæã§ãã¾ãã"
#: ../../tutorial/classes.rst:884
msgid "Generator Expressions"
msgstr "ã¸ã§ãã¬ã¼ã¿å¼"
#: ../../tutorial/classes.rst:886
msgid ""
"Some simple generators can be coded succinctly as expressions using a syntax "
"similar to list comprehensions but with parentheses instead of square "
"brackets. These expressions are designed for situations where the generator "
"is used right away by an enclosing function. Generator expressions are more "
"compact but less versatile than full generator definitions and tend to be "
"more memory friendly than equivalent list comprehensions."
msgstr ""
"åç´ãªã¸ã§ãã¬ã¼ã¿ãªãå¼ã¨ãã¦ç°¡æ½ã«ã³ã¼ãã£ã³ã°ã§ãã¾ãã\n"
"ãã®å¼ã¯ãªã¹ãå
å
表è¨ã«ä¼¼ãæ§æã使ãã¾ãããè§æ¬å¼§ã§ã¯ãªã丸æ¬å¼§ã§å²ãã¾"
"ãã\n"
"ã¸ã§ãã¬ã¼ã¿å¼ã¯ã颿°ã®ä¸ã§ã¸ã§ãã¬ã¼ã¿ãããã«ä½¿ããããããªç¶æ³ã®ããã«ç¨"
"æããã¦ãã¾ãã\n"
"ã¸ã§ãã¬ã¼ã¿å¼ã¯å®å
¨ãªã¸ã§ãã¬ã¼ã¿ã®å®ç¾©ããã³ã³ãã¯ãã§ãããã¡ãã£ã¨èéã®"
"å¹ããªãã¨ãããããã¾ãã\n"
"åãå
容ãè¿ããªã¹ãå
å
表è¨ããã¯ã¡ã¢ãªã«åªãããã¨ãå¤ãã¨ããå©ç¹ãããã¾"
"ãã"
#: ../../tutorial/classes.rst:893
msgid "Examples::"
msgstr "ä¾::"
#: ../../tutorial/classes.rst:917
msgid "Footnotes"
msgstr "èæ³¨"
#: ../../tutorial/classes.rst:918
msgid ""
"Except for one thing. Module objects have a secret read-only attribute "
"called :attr:`~object.__dict__` which returns the dictionary used to "
"implement the module's namespace; the name :attr:`~object.__dict__` is an "
"attribute but not a global name. Obviously, using this violates the "
"abstraction of namespace implementation, and should be restricted to things "
"like post-mortem debuggers."
msgstr ""
"ä¾å¤ãä¸ã¤ããã¾ããã¢ã¸ã¥ã¼ã«ãªãã¸ã§ã¯ãã«ã¯ãç§å¯ã®èªåãå°ç¨ã®å±æ§ :attr:"
"`~object.__dict__` ããããã¢ã¸ã¥ã¼ã«ã®åå空éãå®è£
ããããã«ä½¿ããã¦ããè¾"
"æ¸ãè¿ãã¾ã; :attr:`~object.__dict__` ã¨ããååã¯å±æ§ã§ãããã°ãã¼ãã«ãªå"
"åã§ã¯ããã¾ããããã®å±æ§ãå©ç¨ããã¨åå空éã®å®è£
ã«å¯¾ããæ½è±¡åãä¾µããã¨"
"ã«ãªãã®ã§ãããã°ã©ã ãæ¤æ»ãããããã¬ã®ãããªç¨éã«éãã¹ãã§ãã"