@@ -517,16 +517,21 @@ msgid ""
517
517
"assignment. :attr:`!__doc__` is also a valid attribute, returning the "
518
518
"docstring belonging to the class: ``\" A simple example class\" ``."
519
519
msgstr ""
520
+ "``MyClass.i`` と ``MyClass.f`` は有効な属性参照であり、それぞれ整数と関数オブ"
521
+ "ジェクトを返します。クラス属性も代入できるため、代入により ``MyClass.i`` の値"
522
+ "を変えられます。 :attr:`!__doc__` も有効な属性で、そのクラスに属しているド"
523
+ "キュメンテーション文字列(docstring) 、この場合は ``\" A simple example "
524
+ "class\" `` を返します。"
520
525
521
526
#: ../../tutorial/classes.rst:282
522
527
msgid ""
523
528
"Class *instantiation* uses function notation. Just pretend that the class "
524
529
"object is a parameterless function that returns a new instance of the class. "
525
530
"For example (assuming the above class)::"
526
531
msgstr ""
527
- "クラスの *インスタンス化 (instantiation)* には関数のような表記法を使います。 "
528
- "クラスオブジェクトのことを、単にクラスの新しいインスタンスを返す引数がない関 "
529
- "数のように振る舞います。例えば (上記のクラスでいえば) ::"
532
+ "クラスの *インスタンス化 (instantiation)* には関数記法を使います。クラスオブ "
533
+ "ジェクトのことを、クラスの新しいインスタンスを返す、引数のない関数のように "
534
+ "扱ってください。上記クラスで例示すると ::"
530
535
531
536
#: ../../tutorial/classes.rst:288
532
537
msgid ""
@@ -543,6 +548,10 @@ msgid ""
543
548
"specific initial state. Therefore a class may define a special method named :"
544
549
"meth:`~object.__init__`, like this::"
545
550
msgstr ""
551
+ "インスタンス化操作 (クラスオブジェクトの \" 呼出し\" ) では、空のオブジェクトが"
552
+ "作られます。多くのクラスでは、特定の初期状態にカスタマイズされたオブジェクト"
553
+ "を作りたいです。そのために、クラスには :meth:`~object.__init__` という名前の"
554
+ "特殊メソッドを定義できます。例えば次のようにします::"
546
555
547
556
#: ../../tutorial/classes.rst:299
548
557
msgid ""
@@ -551,13 +560,20 @@ msgid ""
551
560
"instance. So in this example, a new, initialized instance can be obtained "
552
561
"by::"
553
562
msgstr ""
563
+ "クラスが :meth:`~object.__init__` メソッドを定義している場合、クラスをインス"
564
+ "タンス化すると、新しく作られたクラスインスタンスに対して自動的に :meth:`!"
565
+ "__init__` を呼び出します。 従って この例では、新たな初期済みインスタンスを次"
566
+ "のようにして得られます::"
554
567
555
568
#: ../../tutorial/classes.rst:305
556
569
msgid ""
557
570
"Of course, the :meth:`~object.__init__` method may have arguments for "
558
571
"greater flexibility. In that case, arguments given to the class "
559
572
"instantiation operator are passed on to :meth:`!__init__`. For example, ::"
560
573
msgstr ""
574
+ "もちろん、より大きな柔軟性を持たせるために、 :meth:`~object.__init__` メソッ"
575
+ "ドに複数の引数をもたせることができます。その場合、次の例のように、クラスのイ"
576
+ "ンスタンス化操作に渡された引数は :meth:`!__init__` に渡されます。例えば、 ::"
561
577
562
578
#: ../../tutorial/classes.rst:322
563
579
msgid "Instance Objects"
@@ -582,6 +598,11 @@ msgid ""
582
598
"following piece of code will print the value ``16``, without leaving a "
583
599
"trace::"
584
600
msgstr ""
601
+ "*データ属性 (data attribute)* は、 Smalltalk の \" インスタンス変数\" や C+"
602
+ "+の \" データメンバ\" に相当します。データ属性を宣言する必要はありません。ロー"
603
+ "カル変数と同様に、これらの属性は最初に代入された時点で湧き出てきます。例え"
604
+ "ば、上で生成した :class:`!MyClass` のインスタンス ``x`` に対して、次のコード"
605
+ "を実行すると、跡を残さず値 ``16`` を印字します:"
585
606
586
607
#: ../../tutorial/classes.rst:340
587
608
msgid ""
0 commit comments