Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit02daaa5

Browse files
Sync with CPython 3.10 (#230)
* sync with cpython 7445949a* sync with cpython f2fbfbe0* sync with cpython 44666c32* sync with cpython 6a7dd3f9Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent5d3e92b commit02daaa5

File tree

5 files changed

+780
-768
lines changed

5 files changed

+780
-768
lines changed

‎library/dataclasses.po

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ msgid ""
55
msgstr ""
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`."
538538
msgstr""
539539

540-
#:../../library/dataclasses.rst:480
540+
#:../../library/dataclasses.rst:482
541541
msgid""
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`."
545545
msgstr""
546546

547-
#:../../library/dataclasses.rst:485
547+
#:../../library/dataclasses.rst:487
548548
msgid"Post-init processing"
549549
msgstr""
550550

551-
#:../../library/dataclasses.rst:487
551+
#:../../library/dataclasses.rst:489
552552
msgid""
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."
559559
msgstr""
560560

561-
#:../../library/dataclasses.rst:495
561+
#:../../library/dataclasses.rst:497
562562
msgid""
563563
"Among other uses, this allows for initializing field values that depend on "
564564
"one or more other fields. For example::"
565565
msgstr""
566566

567-
#:../../library/dataclasses.rst:507
567+
#:../../library/dataclasses.rst:509
568568
msgid""
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::"
573573
msgstr""
574574

575-
#:../../library/dataclasses.rst:524
575+
#:../../library/dataclasses.rst:526
576576
msgid""
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."
580580
msgstr""
581581

582-
#:../../library/dataclasses.rst:528
582+
#:../../library/dataclasses.rst:530
583583
msgid""
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."
587587
msgstr""
588588

589-
#:../../library/dataclasses.rst:533
589+
#:../../library/dataclasses.rst:535
590590
msgid"Class variables"
591591
msgstr""
592592

593-
#:../../library/dataclasses.rst:535
593+
#:../../library/dataclasses.rst:537
594594
msgid""
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."
601601
msgstr""
602602

603-
#:../../library/dataclasses.rst:544
603+
#:../../library/dataclasses.rst:546
604604
msgid"Init-only variables"
605605
msgstr""
606606

607-
#:../../library/dataclasses.rst:546
607+
#:../../library/dataclasses.rst:548
608608
msgid""
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."
617617
msgstr""
618618

619-
#:../../library/dataclasses.rst:556
619+
#:../../library/dataclasses.rst:558
620620
msgid""
621621
"For example, suppose a field will be initialized from a database, if a value "
622622
"is not provided when creating the class::"
623623
msgstr""
624624

625-
#:../../library/dataclasses.rst:571
625+
#:../../library/dataclasses.rst:573
626626
msgid""
627627
"In this case, :func:`fields` will return :class:`Field` objects for ``i`` "
628628
"and ``j``, but not for ``database``."
629629
msgstr""
630630

631-
#:../../library/dataclasses.rst:575
631+
#:../../library/dataclasses.rst:577
632632
msgid"Frozen instances"
633633
msgstr""
634634

635-
#:../../library/dataclasses.rst:577
635+
#:../../library/dataclasses.rst:579
636636
msgid""
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."
642642
msgstr""
643643

644-
#:../../library/dataclasses.rst:583
644+
#:../../library/dataclasses.rst:585
645645
msgid""
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__`."
649649
msgstr""
650650

651-
#:../../library/dataclasses.rst:588
651+
#:../../library/dataclasses.rst:590
652652
msgid"Inheritance"
653653
msgstr""
654654

655-
#:../../library/dataclasses.rst:590
655+
#:../../library/dataclasses.rst:592
656656
msgid""
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::"
665665
msgstr""
666666

667-
#:../../library/dataclasses.rst:610
667+
#:../../library/dataclasses.rst:612
668668
msgid""
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``."
671671
msgstr""
672672

673-
#:../../library/dataclasses.rst:613
673+
#:../../library/dataclasses.rst:615
674674
msgid"The generated :meth:`__init__` method for ``C`` will look like::"
675675
msgstr""
676676

677-
#:../../library/dataclasses.rst:618
677+
#:../../library/dataclasses.rst:620
678678
msgid"Re-ordering of keyword-only parameters in :meth:`__init__`"
679679
msgstr""
680680

681-
#:../../library/dataclasses.rst:620
681+
#:../../library/dataclasses.rst:622
682682
msgid""
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."
687687
msgstr""
688688

689-
#:../../library/dataclasses.rst:626
689+
#:../../library/dataclasses.rst:628
690690
msgid""
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::"
693693
msgstr""
694694

695-
#:../../library/dataclasses.rst:641
695+
#:../../library/dataclasses.rst:643
696696
msgid"The generated :meth:`__init__` method for ``D`` will look like::"
697697
msgstr""
698698

699-
#:../../library/dataclasses.rst:645
699+
#:../../library/dataclasses.rst:647
700700
msgid""
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."
704704
msgstr""
705705

706-
#:../../library/dataclasses.rst:649
706+
#:../../library/dataclasses.rst:651
707707
msgid""
708708
"The relative ordering of keyword-only parameters is maintained in the re-"
709709
"ordered :meth:`__init__` parameter list."
710710
msgstr""
711711

712-
#:../../library/dataclasses.rst:654
712+
#:../../library/dataclasses.rst:656
713713
msgid"Default factory functions"
714714
msgstr""
715715

716-
#:../../library/dataclasses.rst:656
716+
#:../../library/dataclasses.rst:658
717717
msgid""
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::"
721721
msgstr""
722722

723-
#:../../library/dataclasses.rst:662
723+
#:../../library/dataclasses.rst:664
724724
msgid""
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."
729729
msgstr""
730730

731-
#:../../library/dataclasses.rst:669
731+
#:../../library/dataclasses.rst:671
732732
msgid"Mutable default values"
733733
msgstr""
734734

735-
#:../../library/dataclasses.rst:671
735+
#:../../library/dataclasses.rst:673
736736
msgid""
737737
"Python stores default member variable values in class attributes. Consider "
738738
"this example, not using dataclasses::"
739739
msgstr""
740740

741-
#:../../library/dataclasses.rst:686
741+
#:../../library/dataclasses.rst:688
742742
msgid""
743743
"Note that the two instances of class ``C`` share the same class variable "
744744
"``x``, as expected."
745745
msgstr""
746746

747-
#:../../library/dataclasses.rst:689
747+
#:../../library/dataclasses.rst:691
748748
msgid"Using dataclasses, *if* this code was valid::"
749749
msgstr""
750750

751-
#:../../library/dataclasses.rst:697
751+
#:../../library/dataclasses.rst:699
752752
msgid"it would generate code similar to::"
753753
msgstr""
754754

755-
#:../../library/dataclasses.rst:708
755+
#:../../library/dataclasses.rst:710
756756
msgid""
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."
766766
msgstr""
767767

768-
#:../../library/dataclasses.rst:719
768+
#:../../library/dataclasses.rst:721
769769
msgid""
770770
"Using default factory functions is a way to create new instances of mutable "
771771
"types as default values for fields::"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp