55msgstr ""
66"Project-Id-Version :Python 3.10\n "
77"Report-Msgid-Bugs-To :\n "
8- "POT-Creation-Date :2022-01-09 00:10+0000\n "
8+ "POT-Creation-Date :2022-02-10 00:10+0000\n "
99"PO-Revision-Date :2018-07-15 18:56+0800\n "
1010"Last-Translator :\n "
1111"Language-Team :Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -537,18 +537,18 @@ msgid ""
537537"type is :const:`KW_ONLY`."
538538msgstr ""
539539
540- #: ../../library/dataclasses.rst:480
540+ #: ../../library/dataclasses.rst:482
541541msgid ""
542542"Raised when an implicitly defined :meth:`__setattr__` or :meth:`__delattr__` "
543543"is called on a dataclass which was defined with ``frozen=True``. It is a "
544544"subclass of :exc:`AttributeError`."
545545msgstr ""
546546
547- #: ../../library/dataclasses.rst:485
547+ #: ../../library/dataclasses.rst:487
548548msgid "Post-init processing"
549549msgstr ""
550550
551- #: ../../library/dataclasses.rst:487
551+ #: ../../library/dataclasses.rst:489
552552msgid ""
553553"The generated :meth:`__init__` code will call a method named :meth:"
554554"`__post_init__`, if :meth:`__post_init__` is defined on the class. It will "
@@ -558,39 +558,39 @@ msgid ""
558558"generated, then :meth:`__post_init__` will not automatically be called."
559559msgstr ""
560560
561- #: ../../library/dataclasses.rst:495
561+ #: ../../library/dataclasses.rst:497
562562msgid ""
563563"Among other uses, this allows for initializing field values that depend on "
564564"one or more other fields. For example::"
565565msgstr ""
566566
567- #: ../../library/dataclasses.rst:507
567+ #: ../../library/dataclasses.rst:509
568568msgid ""
569569"The :meth:`__init__` method generated by :func:`dataclass` does not call "
570570"base class :meth:`__init__` methods. If the base class has an :meth:"
571571"`__init__` method that has to be called, it is common to call this method in "
572572"a :meth:`__post_init__` method::"
573573msgstr ""
574574
575- #: ../../library/dataclasses.rst:524
575+ #: ../../library/dataclasses.rst:526
576576msgid ""
577577"Note, however, that in general the dataclass-generated :meth:`__init__` "
578578"methods don't need to be called, since the derived dataclass will take care "
579579"of initializing all fields of any base class that is a dataclass itself."
580580msgstr ""
581581
582- #: ../../library/dataclasses.rst:528
582+ #: ../../library/dataclasses.rst:530
583583msgid ""
584584"See the section below on init-only variables for ways to pass parameters to :"
585585"meth:`__post_init__`. Also see the warning about how :func:`replace` "
586586"handles ``init=False`` fields."
587587msgstr ""
588588
589- #: ../../library/dataclasses.rst:533
589+ #: ../../library/dataclasses.rst:535
590590msgid "Class variables"
591591msgstr ""
592592
593- #: ../../library/dataclasses.rst:535
593+ #: ../../library/dataclasses.rst:537
594594msgid ""
595595"One of two places where :func:`dataclass` actually inspects the type of a "
596596"field is to determine if a field is a class variable as defined in :pep:"
@@ -600,11 +600,11 @@ msgid ""
600600"pseudo-fields are not returned by the module-level :func:`fields` function."
601601msgstr ""
602602
603- #: ../../library/dataclasses.rst:544
603+ #: ../../library/dataclasses.rst:546
604604msgid "Init-only variables"
605605msgstr ""
606606
607- #: ../../library/dataclasses.rst:546
607+ #: ../../library/dataclasses.rst:548
608608msgid ""
609609"The other place where :func:`dataclass` inspects a type annotation is to "
610610"determine if a field is an init-only variable. It does this by seeing if "
@@ -616,23 +616,23 @@ msgid ""
616616"`__post_init__` method. They are not otherwise used by dataclasses."
617617msgstr ""
618618
619- #: ../../library/dataclasses.rst:556
619+ #: ../../library/dataclasses.rst:558
620620msgid ""
621621"For example, suppose a field will be initialized from a database, if a value "
622622"is not provided when creating the class::"
623623msgstr ""
624624
625- #: ../../library/dataclasses.rst:571
625+ #: ../../library/dataclasses.rst:573
626626msgid ""
627627"In this case, :func:`fields` will return :class:`Field` objects for ``i`` "
628628"and ``j``, but not for ``database``."
629629msgstr ""
630630
631- #: ../../library/dataclasses.rst:575
631+ #: ../../library/dataclasses.rst:577
632632msgid "Frozen instances"
633633msgstr ""
634634
635- #: ../../library/dataclasses.rst:577
635+ #: ../../library/dataclasses.rst:579
636636msgid ""
637637"It is not possible to create truly immutable Python objects. However, by "
638638"passing ``frozen=True`` to the :meth:`dataclass` decorator you can emulate "
@@ -641,18 +641,18 @@ msgid ""
641641"`FrozenInstanceError` when invoked."
642642msgstr ""
643643
644- #: ../../library/dataclasses.rst:583
644+ #: ../../library/dataclasses.rst:585
645645msgid ""
646646"There is a tiny performance penalty when using ``frozen=True``: :meth:"
647647"`__init__` cannot use simple assignment to initialize fields, and must use :"
648648"meth:`object.__setattr__`."
649649msgstr ""
650650
651- #: ../../library/dataclasses.rst:588
651+ #: ../../library/dataclasses.rst:590
652652msgid "Inheritance"
653653msgstr ""
654654
655- #: ../../library/dataclasses.rst:590
655+ #: ../../library/dataclasses.rst:592
656656msgid ""
657657"When the dataclass is being created by the :meth:`dataclass` decorator, it "
658658"looks through all of the class's base classes in reverse MRO (that is, "
@@ -664,95 +664,95 @@ msgid ""
664664"derived classes override base classes. An example::"
665665msgstr ""
666666
667- #: ../../library/dataclasses.rst:610
667+ #: ../../library/dataclasses.rst:612
668668msgid ""
669669"The final list of fields is, in order, ``x``, ``y``, ``z``. The final type "
670670"of ``x`` is ``int``, as specified in class ``C``."
671671msgstr ""
672672
673- #: ../../library/dataclasses.rst:613
673+ #: ../../library/dataclasses.rst:615
674674msgid "The generated :meth:`__init__` method for ``C`` will look like::"
675675msgstr ""
676676
677- #: ../../library/dataclasses.rst:618
677+ #: ../../library/dataclasses.rst:620
678678msgid "Re-ordering of keyword-only parameters in :meth:`__init__`"
679679msgstr ""
680680
681- #: ../../library/dataclasses.rst:620
681+ #: ../../library/dataclasses.rst:622
682682msgid ""
683683"After the parameters needed for :meth:`__init__` are computed, any keyword-"
684684"only parameters are moved to come after all regular (non-keyword-only) "
685685"parameters. This is a requirement of how keyword-only parameters are "
686686"implemented in Python: they must come after non-keyword-only parameters."
687687msgstr ""
688688
689- #: ../../library/dataclasses.rst:626
689+ #: ../../library/dataclasses.rst:628
690690msgid ""
691691"In this example, ``Base.y``, ``Base.w``, and ``D.t`` are keyword-only "
692692"fields, and ``Base.x`` and ``D.z`` are regular fields::"
693693msgstr ""
694694
695- #: ../../library/dataclasses.rst:641
695+ #: ../../library/dataclasses.rst:643
696696msgid "The generated :meth:`__init__` method for ``D`` will look like::"
697697msgstr ""
698698
699- #: ../../library/dataclasses.rst:645
699+ #: ../../library/dataclasses.rst:647
700700msgid ""
701701"Note that the parameters have been re-ordered from how they appear in the "
702702"list of fields: parameters derived from regular fields are followed by "
703703"parameters derived from keyword-only fields."
704704msgstr ""
705705
706- #: ../../library/dataclasses.rst:649
706+ #: ../../library/dataclasses.rst:651
707707msgid ""
708708"The relative ordering of keyword-only parameters is maintained in the re-"
709709"ordered :meth:`__init__` parameter list."
710710msgstr ""
711711
712- #: ../../library/dataclasses.rst:654
712+ #: ../../library/dataclasses.rst:656
713713msgid "Default factory functions"
714714msgstr ""
715715
716- #: ../../library/dataclasses.rst:656
716+ #: ../../library/dataclasses.rst:658
717717msgid ""
718718"If a :func:`field` specifies a ``default_factory``, it is called with zero "
719719"arguments when a default value for the field is needed. For example, to "
720720"create a new instance of a list, use::"
721721msgstr ""
722722
723- #: ../../library/dataclasses.rst:662
723+ #: ../../library/dataclasses.rst:664
724724msgid ""
725725"If a field is excluded from :meth:`__init__` (using ``init=False``) and the "
726726"field also specifies ``default_factory``, then the default factory function "
727727"will always be called from the generated :meth:`__init__` function. This "
728728"happens because there is no other way to give the field an initial value."
729729msgstr ""
730730
731- #: ../../library/dataclasses.rst:669
731+ #: ../../library/dataclasses.rst:671
732732msgid "Mutable default values"
733733msgstr ""
734734
735- #: ../../library/dataclasses.rst:671
735+ #: ../../library/dataclasses.rst:673
736736msgid ""
737737"Python stores default member variable values in class attributes. Consider "
738738"this example, not using dataclasses::"
739739msgstr ""
740740
741- #: ../../library/dataclasses.rst:686
741+ #: ../../library/dataclasses.rst:688
742742msgid ""
743743"Note that the two instances of class ``C`` share the same class variable "
744744"``x``, as expected."
745745msgstr ""
746746
747- #: ../../library/dataclasses.rst:689
747+ #: ../../library/dataclasses.rst:691
748748msgid "Using dataclasses, *if* this code was valid::"
749749msgstr ""
750750
751- #: ../../library/dataclasses.rst:697
751+ #: ../../library/dataclasses.rst:699
752752msgid "it would generate code similar to::"
753753msgstr ""
754754
755- #: ../../library/dataclasses.rst:708
755+ #: ../../library/dataclasses.rst:710
756756msgid ""
757757"This has the same issue as the original example using class ``C``. That is, "
758758"two instances of class ``D`` that do not specify a value for ``x`` when "
@@ -765,7 +765,7 @@ msgid ""
765765"errors."
766766msgstr ""
767767
768- #: ../../library/dataclasses.rst:719
768+ #: ../../library/dataclasses.rst:721
769769msgid ""
770770"Using default factory functions is a way to create new instances of mutable "
771771"types as default values for fields::"