@@ -11,7 +11,7 @@ msgid ""
11
11
msgstr ""
12
12
"Project-Id-Version :Python 3.12\n "
13
13
"Report-Msgid-Bugs-To :\n "
14
- "POT-Creation-Date :2023-08-22 00:03 +0000\n "
14
+ "POT-Creation-Date :2023-12-19 13:45 +0000\n "
15
15
"PO-Revision-Date :2022-10-23 20:30+0800\n "
16
16
"Last-Translator :Phil Lin <linooohon@gmail.com>\n "
17
17
"Language-Team :Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -560,20 +560,22 @@ msgid ""
560
560
msgstr "Import 套件時,Python 會搜尋 ``sys.path`` 裡的目錄,尋找套件的子目錄。"
561
561
562
562
#: ../../tutorial/modules.rst:439
563
+ #, fuzzy
563
564
msgid ""
564
565
"The :file:`__init__.py` files are required to make Python treat directories "
565
- "containing the file as packages. This prevents directories with a common "
566
- "name, such as ``string``, from unintentionally hiding valid modules that "
567
- "occur later on the module search path. In the simplest case, :file:`__init__."
568
- "py` can just be an empty file, but it can also execute initialization code "
569
- "for the package or set the ``__all__`` variable, described later."
566
+ "containing the file as packages (unless using a :term:`namespace package`, a "
567
+ "relatively advanced feature). This prevents directories with a common name, "
568
+ "such as ``string``, from unintentionally hiding valid modules that occur "
569
+ "later on the module search path. In the simplest case, :file:`__init__.py` "
570
+ "can just be an empty file, but it can also execute initialization code for "
571
+ "the package or set the ``__all__`` variable, described later."
570
572
msgstr ""
571
573
"目錄中必須含有 :file:`__init__.py` 檔案,才會被 Pyhon 當成套件;這樣可以避免"
572
574
"一些以常用名稱命名(例如 ``string``\\ )的目錄,無意中隱藏了較晚出現在模組搜"
573
575
"尋路徑中的有效模組。在最簡單的情況,:file:`__init__.py` 可以只是一個空白檔"
574
576
"案;但它也可以執行套件的初始化程式碼,或設置 ``__all__`` 變數,之後會詳述。"
575
577
576
- #: ../../tutorial/modules.rst:446
578
+ #: ../../tutorial/modules.rst:447
577
579
msgid ""
578
580
"Users of the package can import individual modules from the package, for "
579
581
"example::"
@@ -582,7 +584,7 @@ msgstr ""
582
584
"\n"
583
585
"::"
584
586
585
- #: ../../tutorial/modules.rst:451
587
+ #: ../../tutorial/modules.rst:452
586
588
msgid ""
587
589
"This loads the submodule :mod:`!sound.effects.echo`. It must be referenced "
588
590
"with its full name. ::"
@@ -591,14 +593,14 @@ msgstr ""
591
593
"\n"
592
594
"::"
593
595
594
- #: ../../tutorial/modules.rst:456
596
+ #: ../../tutorial/modules.rst:457
595
597
msgid "An alternative way of importing the submodule is::"
596
598
msgstr ""
597
599
"另一種 import 子模組的方法是:\n"
598
600
"\n"
599
601
"::"
600
602
601
- #: ../../tutorial/modules.rst:460
603
+ #: ../../tutorial/modules.rst:461
602
604
msgid ""
603
605
"This also loads the submodule :mod:`!echo`, and makes it available without "
604
606
"its package prefix, so it can be used as follows::"
@@ -608,7 +610,7 @@ msgstr ""
608
610
"\n"
609
611
"::"
610
612
611
- #: ../../tutorial/modules.rst:465
613
+ #: ../../tutorial/modules.rst:466
612
614
msgid ""
613
615
"Yet another variation is to import the desired function or variable "
614
616
"directly::"
@@ -617,7 +619,7 @@ msgstr ""
617
619
"\n"
618
620
"::"
619
621
620
- #: ../../tutorial/modules.rst:469
622
+ #: ../../tutorial/modules.rst:470
621
623
msgid ""
622
624
"Again, this loads the submodule :mod:`!echo`, but this makes its function :"
623
625
"func:`!echofilter` directly available::"
@@ -627,7 +629,7 @@ msgstr ""
627
629
"\n"
628
630
"::"
629
631
630
- #: ../../tutorial/modules.rst:474
632
+ #: ../../tutorial/modules.rst:475
631
633
msgid ""
632
634
"Note that when using ``from package import item``, the item can be either a "
633
635
"submodule (or subpackage) of the package, or some other name defined in the "
@@ -641,7 +643,7 @@ msgstr ""
641
643
"陳述式首先測試套件中有沒有定義該 item;如果沒有,則會假設它是模組,並嘗試載"
642
644
"入。如果還是找不到 item,則會引發 :exc:`ImportError` 例外。"
643
645
644
- #: ../../tutorial/modules.rst:481
646
+ #: ../../tutorial/modules.rst:482
645
647
msgid ""
646
648
"Contrarily, when using syntax like ``import item.subitem.subsubitem``, each "
647
649
"item except for the last must be a package; the last item can be a module or "
@@ -652,11 +654,11 @@ msgstr ""
652
654
"一項都必須是套件;最後一項可以是模組或套件,但不能是前一項中定義的 class、函"
653
655
"式或變數。"
654
656
655
- #: ../../tutorial/modules.rst:490
657
+ #: ../../tutorial/modules.rst:491
656
658
msgid "Importing\\ * From a Package"
657
659
msgstr "從套件中 import\\ *"
658
660
659
- #: ../../tutorial/modules.rst:494
661
+ #: ../../tutorial/modules.rst:495
660
662
msgid ""
661
663
"Now what happens when the user writes ``from sound.effects import *``? "
662
664
"Ideally, one would hope that this somehow goes out to the filesystem, finds "
@@ -669,7 +671,7 @@ msgstr ""
669
671
"會花費較長的時間,且 import 子模組的過程可能會有不必要的副作用,這些副作用只"
670
672
"有在明確地 import 子模組時才會發生。"
671
673
672
- #: ../../tutorial/modules.rst:500
674
+ #: ../../tutorial/modules.rst:501
673
675
msgid ""
674
676
"The only solution is for the package author to provide an explicit index of "
675
677
"the package. The :keyword:`import` statement uses the following convention: "
@@ -690,15 +692,15 @@ msgstr ""
690
692
"\n"
691
693
"::"
692
694
693
- #: ../../tutorial/modules.rst:512
695
+ #: ../../tutorial/modules.rst:513
694
696
msgid ""
695
697
"This would mean that ``from sound.effects import *`` would import the three "
696
698
"named submodules of the :mod:`!sound.effects` package."
697
699
msgstr ""
698
700
"意思是,``from sound.effects import *`` 將會 import :mod:`!sound.effects` 套"
699
701
"件中,這三個被提名的子模組。"
700
702
701
- #: ../../tutorial/modules.rst:515
703
+ #: ../../tutorial/modules.rst:516
702
704
msgid ""
703
705
"Be aware that submodules might become shadowed by locally defined names. For "
704
706
"example, if you added a ``reverse`` function to the :file:`sound/effects/"
@@ -713,7 +715,7 @@ msgstr ""
713
715
"但\\ *不是* ``reverse`` 子模組,因為它被區域定義的 ``reverse`` 函式遮蔽"
714
716
"了: ::"
715
717
716
- #: ../../tutorial/modules.rst:531
718
+ #: ../../tutorial/modules.rst:532
717
719
msgid ""
718
720
"If ``__all__`` is not defined, the statement ``from sound.effects import *`` "
719
721
"does *not* import all submodules from the package :mod:`!sound.effects` into "
@@ -734,7 +736,7 @@ msgstr ""
734
736
"\n"
735
737
"::"
736
738
737
- #: ../../tutorial/modules.rst:544
739
+ #: ../../tutorial/modules.rst:545
738
740
msgid ""
739
741
"In this example, the :mod:`!echo` and :mod:`!surround` modules are imported "
740
742
"in the current namespace because they are defined in the :mod:`!sound."
@@ -745,7 +747,7 @@ msgstr ""
745
747
"surround` 模組被 import 進當前的命名空間,因為它們是在 :mod:`!sound.effects` "
746
748
"套件裡定義的。(當 ``__all__`` 有被定義時,這規則也有效。)"
747
749
748
- #: ../../tutorial/modules.rst:549
750
+ #: ../../tutorial/modules.rst:550
749
751
msgid ""
750
752
"Although certain modules are designed to export only names that follow "
751
753
"certain patterns when you use ``import *``, it is still considered bad "
@@ -754,7 +756,7 @@ msgstr ""
754
756
"雖然,有些特定模組的設計,讓你使用 ``import *`` 時,該模組只會輸出遵循特定樣"
755
757
"式的名稱,但在正式環境 (production) 的程式碼中這仍然被視為是不良習慣。"
756
758
757
- #: ../../tutorial/modules.rst:553
759
+ #: ../../tutorial/modules.rst:554
758
760
msgid ""
759
761
"Remember, there is nothing wrong with using ``from package import "
760
762
"specific_submodule``! In fact, this is the recommended notation unless the "
@@ -764,11 +766,11 @@ msgstr ""
764
766
"記住,使用 ``from package import specific_submodule`` 不會有任何問題!實際"
765
767
"上,這是推薦用法,除非 import 的模組需要用到的子模組和其他套件的子模組同名。"
766
768
767
- #: ../../tutorial/modules.rst:562
769
+ #: ../../tutorial/modules.rst:563
768
770
msgid "Intra-package References"
769
771
msgstr "套件內引用"
770
772
771
- #: ../../tutorial/modules.rst:564
773
+ #: ../../tutorial/modules.rst:565
772
774
msgid ""
773
775
"When packages are structured into subpackages (as with the :mod:`!sound` "
774
776
"package in the example), you can use absolute imports to refer to submodules "
@@ -781,7 +783,7 @@ msgstr ""
781
783
"filters.vocoder` 模組中使用 :mod:`!sound.effects` 中的 :mod:`!echo` 模組時,"
782
784
"可以用 ``from sound.effects import echo``。"
783
785
784
- #: ../../tutorial/modules.rst:570
786
+ #: ../../tutorial/modules.rst:571
785
787
msgid ""
786
788
"You can also write relative imports, with the ``from module import name`` "
787
789
"form of import statement. These imports use leading dots to indicate the "
@@ -794,7 +796,7 @@ msgstr ""
794
796
"\n"
795
797
"::"
796
798
797
- #: ../../tutorial/modules.rst:579
799
+ #: ../../tutorial/modules.rst:580
798
800
msgid ""
799
801
"Note that relative imports are based on the name of the current module. "
800
802
"Since the name of the main module is always ``\" __main__\" ``, modules "
@@ -805,11 +807,11 @@ msgstr ""
805
807
"``\" __main__\" ``,所以如果一個模組預期被用作 Python 應用程式的主模組,那它必"
806
808
"須永遠使用絕對 import。"
807
809
808
- #: ../../tutorial/modules.rst:585
810
+ #: ../../tutorial/modules.rst:586
809
811
msgid "Packages in Multiple Directories"
810
812
msgstr "多目錄中的套件"
811
813
812
- #: ../../tutorial/modules.rst:587
814
+ #: ../../tutorial/modules.rst:588
813
815
msgid ""
814
816
"Packages support one more special attribute, :attr:`__path__`. This is "
815
817
"initialized to be a list containing the name of the directory holding the "
@@ -821,17 +823,17 @@ msgstr ""
821
823
"的 :file:`__init__.py` 檔案所在的目錄名稱,初始化時機是在這個檔案的程式碼被執"
822
824
"行之前。這個變數可以被修改,但這樣做會影響將來對套件內的模組和子套件的搜尋。"
823
825
824
- #: ../../tutorial/modules.rst:593
826
+ #: ../../tutorial/modules.rst:594
825
827
msgid ""
826
828
"While this feature is not often needed, it can be used to extend the set of "
827
829
"modules found in a package."
828
830
msgstr "雖然這個特色不太常被需要,但它可用於擴充套件中的模組集合。"
829
831
830
- #: ../../tutorial/modules.rst:598
832
+ #: ../../tutorial/modules.rst:599
831
833
msgid "Footnotes"
832
834
msgstr "註解"
833
835
834
- #: ../../tutorial/modules.rst:599
836
+ #: ../../tutorial/modules.rst:600
835
837
msgid ""
836
838
"In fact function definitions are also 'statements' that are 'executed'; the "
837
839
"execution of a module-level function definition adds the function name to "
@@ -861,6 +863,6 @@ msgstr "sys"
861
863
msgid "builtins"
862
864
msgstr "builtins(內建)"
863
865
864
- #: ../../tutorial/modules.rst:492
866
+ #: ../../tutorial/modules.rst:493
865
867
msgid "__all__"
866
868
msgstr "__all__"