@@ -13,7 +13,7 @@ msgid ""
13
13
msgstr ""
14
14
"Project-Id-Version : Python 3.9\n "
15
15
"Report-Msgid-Bugs-To : \n "
16
- "POT-Creation-Date : 2021-05-07 06:17 +0000\n "
16
+ "POT-Creation-Date : 2021-05-11 06:18 +0000\n "
17
17
"PO-Revision-Date : 2018-06-29 21:06+0000\n "
18
18
"Last-Translator : Takanori Suzuki <takanori@takanory.net>, 2021\n "
19
19
"Language-Team : Japanese (https://www.transifex.com/python-doc/teams/5390/ja/)\n "
@@ -609,18 +609,33 @@ msgstr ""
609
609
610
610
#: ../../library/dataclasses.rst:425
611
611
msgid ""
612
+ "The :meth:`__init__` method generated by :func:`dataclass` does not call "
613
+ "base class :meth:`__init__` methods. If the base class has an "
614
+ ":meth:`__init__` method that has to be called, it is common to call this "
615
+ "method in a :meth:`__post_init__` method::"
616
+ msgstr ""
617
+
618
+ #: ../../library/dataclasses.rst:442
619
+ msgid ""
620
+ "Note, however, that in general the dataclass-generated :meth:`__init__` "
621
+ "methods don't need to be called, since the derived dataclass will take care "
622
+ "of initializing all fields of any base class that is a dataclass itself."
623
+ msgstr ""
624
+
625
+ #: ../../library/dataclasses.rst:446
626
+ msgid ""
612
627
"See the section below on init-only variables for ways to pass parameters to "
613
628
":meth:`__post_init__`. Also see the warning about how :func:`replace` "
614
629
"handles ``init=False`` fields."
615
630
msgstr ""
616
631
"下にある初期化限定変数についての節で、 :meth:`__post_init__` にパラメータを渡す方法を参照してください。\n"
617
632
":func:`replace` が ``init=False`` であるフィールドをどう取り扱うかについての警告も参照してください。"
618
633
619
- #: ../../library/dataclasses.rst:430
634
+ #: ../../library/dataclasses.rst:451
620
635
msgid "Class variables"
621
636
msgstr "クラス変数"
622
637
623
- #: ../../library/dataclasses.rst:432
638
+ #: ../../library/dataclasses.rst:453
624
639
msgid ""
625
640
"One of two places where :func:`dataclass` actually inspects the type of a "
626
641
"field is to determine if a field is a class variable as defined in "
@@ -635,11 +650,11 @@ msgstr ""
635
650
"フィールドが ``ClassVar`` の場合、フィールドとは見なされなくなり、データクラスの機構からは無視されます。\n"
636
651
"そのような ``ClassVar`` 疑似フィールドは、モジュールレベル関数 :func:`fields` の返り値には含まれません。"
637
652
638
- #: ../../library/dataclasses.rst:441
653
+ #: ../../library/dataclasses.rst:462
639
654
msgid "Init-only variables"
640
655
msgstr "初期化限定変数"
641
656
642
- #: ../../library/dataclasses.rst:443
657
+ #: ../../library/dataclasses.rst:464
643
658
msgid ""
644
659
"The other place where :func:`dataclass` inspects a type annotation is to "
645
660
"determine if a field is an init-only variable. It does this by seeing if "
@@ -657,25 +672,25 @@ msgstr ""
657
672
"初期化限定フィールドは生成された :meth:`__init__` メソッドに引数として追加され、オプションの :meth:`__post_init__` メソッドにも渡されます。\n"
658
673
"初期化限定フィールドは、データクラスからはそれ以外では使われません。"
659
674
660
- #: ../../library/dataclasses.rst:453
675
+ #: ../../library/dataclasses.rst:474
661
676
msgid ""
662
677
"For example, suppose a field will be initialized from a database, if a value"
663
678
" is not provided when creating the class::"
664
679
msgstr "例えば、あるフィールドがデータベースから初期化されると仮定して、クラスを作成するときには値が与えられない次の場合を考えます::"
665
680
666
- #: ../../library/dataclasses.rst:468
681
+ #: ../../library/dataclasses.rst:489
667
682
msgid ""
668
683
"In this case, :func:`fields` will return :class:`Field` objects for ``i`` "
669
684
"and ``j``, but not for ``database``."
670
685
msgstr ""
671
686
"このケースでは、 :func:`fields` は ``i`` と ``j`` の :class:`Field` オブジェクトは返しますが、 "
672
687
"``database`` の :class:`Field` オブジェクトは返しません。"
673
688
674
- #: ../../library/dataclasses.rst:472
689
+ #: ../../library/dataclasses.rst:493
675
690
msgid "Frozen instances"
676
691
msgstr "凍結されたインスタンス"
677
692
678
- #: ../../library/dataclasses.rst:474
693
+ #: ../../library/dataclasses.rst:495
679
694
msgid ""
680
695
"It is not possible to create truly immutable Python objects. However, by "
681
696
"passing ``frozen=True`` to the :meth:`dataclass` decorator you can emulate "
@@ -688,7 +703,7 @@ msgstr ""
688
703
"このケースでは、データクラスは :meth:`__setattr__` メソッドと :meth:`__delattr__` メソッドをクラスに追加します。\n"
689
704
"これらのメソッドは起動すると :exc:`FrozenInstanceError` を送出します。"
690
705
691
- #: ../../library/dataclasses.rst:480
706
+ #: ../../library/dataclasses.rst:501
692
707
msgid ""
693
708
"There is a tiny performance penalty when using ``frozen=True``: "
694
709
":meth:`__init__` cannot use simple assignment to initialize fields, and must"
@@ -697,11 +712,11 @@ msgstr ""
697
712
"``frozen=True`` を使うとき、実行する上でのわずかな代償があります: :meth:`__init__` "
698
713
"でフィールドを初期化するのに単純に割り当てることはできず、 :meth:`object.__setattr__` を使わなくてはなりません。"
699
714
700
- #: ../../library/dataclasses.rst:485
715
+ #: ../../library/dataclasses.rst:506
701
716
msgid "Inheritance"
702
717
msgstr "継承"
703
718
704
- #: ../../library/dataclasses.rst:487
719
+ #: ../../library/dataclasses.rst:508
705
720
msgid ""
706
721
"When the dataclass is being created by the :meth:`dataclass` decorator, it "
707
722
"looks through all of the class's base classes in reverse MRO (that is, "
@@ -718,23 +733,23 @@ msgstr ""
718
733
"フィールドは挿入順序で並んでいるので、派生クラスは基底クラスをオーバーライドします。\n"
719
734
"例えば次のようになります::"
720
735
721
- #: ../../library/dataclasses.rst:507
736
+ #: ../../library/dataclasses.rst:528
722
737
msgid ""
723
738
"The final list of fields is, in order, ``x``, ``y``, ``z``. The final type "
724
739
"of ``x`` is ``int``, as specified in class ``C``."
725
740
msgstr ""
726
741
"最終的に出来上がるフィールドのリストは ``x``, ``y``, ``z`` の順番になります。\n"
727
742
"最終的な ``x`` の型は、 クラス ``C`` で指定されている通り ``int`` です。"
728
743
729
- #: ../../library/dataclasses.rst:510
744
+ #: ../../library/dataclasses.rst:531
730
745
msgid "The generated :meth:`__init__` method for ``C`` will look like::"
731
746
msgstr "``C`` の生成された :meth:`__init__` メソッドは次のようになります::"
732
747
733
- #: ../../library/dataclasses.rst:515
748
+ #: ../../library/dataclasses.rst:536
734
749
msgid "Default factory functions"
735
750
msgstr "デフォルトファクトリ関数"
736
751
737
- #: ../../library/dataclasses.rst:517
752
+ #: ../../library/dataclasses.rst:538
738
753
msgid ""
739
754
"If a :func:`field` specifies a ``default_factory``, it is called with zero "
740
755
"arguments when a default value for the field is needed. For example, to "
@@ -743,7 +758,7 @@ msgstr ""
743
758
":func:`field` に ``default_factory`` を指定した場合、そのフィールドのデフォルト値が必要とされたときに、引数無しで呼び出されます。\n"
744
759
"これは例えば、リストの新しいインスタンスを作成するために使います::"
745
760
746
- #: ../../library/dataclasses.rst:523
761
+ #: ../../library/dataclasses.rst:544
747
762
msgid ""
748
763
"If a field is excluded from :meth:`__init__` (using ``init=False``) and the "
749
764
"field also specifies ``default_factory``, then the default factory function "
@@ -753,33 +768,33 @@ msgstr ""
753
768
"あるフィールドが (``init=False`` を使って) :meth:`__init__` から除外され、かつ、 ``default_factory`` が指定されていた場合、デフォルトファクトリ関数は生成された :meth:`__init__` 関数から常に呼び出されます。\n"
754
769
"フィールドに初期値を与える方法が他に無いので、このような動きになります。"
755
770
756
- #: ../../library/dataclasses.rst:530
771
+ #: ../../library/dataclasses.rst:551
757
772
msgid "Mutable default values"
758
773
msgstr "可変なデフォルト値"
759
774
760
- #: ../../library/dataclasses.rst:532
775
+ #: ../../library/dataclasses.rst:553
761
776
msgid ""
762
777
"Python stores default member variable values in class attributes. Consider "
763
778
"this example, not using dataclasses::"
764
779
msgstr ""
765
780
"Python はメンバ変数のデフォルト値をクラス属性に保持します。\n"
766
781
"データクラスを使っていない、この例を考えてみましょう::"
767
782
768
- #: ../../library/dataclasses.rst:547
783
+ #: ../../library/dataclasses.rst:568
769
784
msgid ""
770
785
"Note that the two instances of class ``C`` share the same class variable "
771
786
"``x``, as expected."
772
787
msgstr "クラス ``C`` の 2 つのインスタンスが、予想通り同じクラス変数 ``x`` を共有していることに注意してください。"
773
788
774
- #: ../../library/dataclasses.rst:550
789
+ #: ../../library/dataclasses.rst:571
775
790
msgid "Using dataclasses, *if* this code was valid::"
776
791
msgstr "データクラスを使っているこのコードが *もし仮に* 有効なものだとしたら::"
777
792
778
- #: ../../library/dataclasses.rst:558
793
+ #: ../../library/dataclasses.rst:579
779
794
msgid "it would generate code similar to::"
780
795
msgstr "データクラスは次のようなコードを生成するでしょう::"
781
796
782
- #: ../../library/dataclasses.rst:569
797
+ #: ../../library/dataclasses.rst:590
783
798
msgid ""
784
799
"This has the same issue as the original example using class ``C``. That is, "
785
800
"two instances of class ``D`` that do not specify a value for ``x`` when "
@@ -796,17 +811,17 @@ msgstr ""
796
811
"データクラスがこの問題を検出する一般的な方法を持たない代わりに、データクラスは型が ``list`` や ``dict`` や ``set`` のデフォルトパラメーターを検出した場合、 :exc:`TypeError` を送出します。\n"
797
812
"これは完全ではない解決法ですが、よくあるエラーの多くを防げます。"
798
813
799
- #: ../../library/dataclasses.rst:579
814
+ #: ../../library/dataclasses.rst:600
800
815
msgid ""
801
816
"Using default factory functions is a way to create new instances of mutable "
802
817
"types as default values for fields::"
803
818
msgstr "デフォルトファクトリ関数を使うのが、フィールドのデフォルト値として可変な型の新しいインスタンスを作成する手段です::"
804
819
805
- #: ../../library/dataclasses.rst:589
820
+ #: ../../library/dataclasses.rst:610
806
821
msgid "Exceptions"
807
822
msgstr "例外"
808
823
809
- #: ../../library/dataclasses.rst:593
824
+ #: ../../library/dataclasses.rst:614
810
825
msgid ""
811
826
"Raised when an implicitly defined :meth:`__setattr__` or :meth:`__delattr__`"
812
827
" is called on a dataclass which was defined with ``frozen=True``. It is a "
0 commit comments