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

Commite7b5675

Browse files
authored
Update translation for library/enum, library/exceptions and howto/sorting (#1010)
1 parentcc66b14 commite7b5675

File tree

3 files changed

+130
-100
lines changed

3 files changed

+130
-100
lines changed

‎howto/sorting.po

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version:Python 3.13\n"
99
"Report-Msgid-Bugs-To:\n"
1010
"POT-Creation-Date:2024-09-03 11:11+0800\n"
11-
"PO-Revision-Date:2023-08-12 15:09+0800\n"
11+
"PO-Revision-Date:2024-12-20 19:16+0800\n"
1212
"Last-Translator:Li-Hung Wang <li-hung@sciwork.dev>\n"
1313
"Language-Team:Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1414
"tw)\n"
@@ -128,6 +128,8 @@ msgid ""
128128
">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n"
129129
"['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']"
130130
msgstr""
131+
">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n"
132+
"['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']"
131133

132134
#:../../howto/sorting.rst:61
133135
msgid""
@@ -157,6 +159,13 @@ msgid ""
157159
">>> sorted(student_tuples, key=lambda student: student[2]) # sort by age\n"
158160
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"
159161
msgstr""
162+
">>> student_tuples = [\n"
163+
"... ('john', 'A', 15),\n"
164+
"... ('jane', 'B', 12),\n"
165+
"... ('dave', 'B', 10),\n"
166+
"... ]\n"
167+
">>> sorted(student_tuples, key=lambda student: student[2]) # 依照年齡排序\n"
168+
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"
160169

161170
#:../../howto/sorting.rst:79
162171
msgid""
@@ -182,6 +191,22 @@ msgid ""
182191
"age\n"
183192
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"
184193
msgstr""
194+
">>> class Student:\n"
195+
"... def __init__(self, name, grade, age):\n"
196+
"... self.name = name\n"
197+
"... self.grade = grade\n"
198+
"... self.age = age\n"
199+
"... def __repr__(self):\n"
200+
"... return repr((self.name, self.grade, self.age))\n"
201+
"\n"
202+
">>> student_objects = [\n"
203+
"... Student('john', 'A', 15),\n"
204+
"... Student('jane', 'B', 12),\n"
205+
"... Student('dave', 'B', 10),\n"
206+
"... ]\n"
207+
">>> sorted(student_objects, key=lambda student: student.age) # 依照年齡排"
208+
"序\n"
209+
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"
185210

186211
#:../../howto/sorting.rst:99
187212
msgid""
@@ -363,6 +388,10 @@ msgid ""
363388
"primary key, descending\n"
364389
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"
365390
msgstr""
391+
">>> s = sorted(student_objects, key=attrgetter('age')) # 依照次要鍵排序\n"
392+
">>> sorted(s, key=attrgetter('grade'), reverse=True) # 現在依照主要鍵降"
393+
"冪排序\n"
394+
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"
366395

367396
#:../../howto/sorting.rst:193
368397
msgid""
@@ -436,6 +465,11 @@ msgid ""
436465
">>> [student for grade, i, student in decorated] # undecorate\n"
437466
"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]"
438467
msgstr""
468+
">>> decorated = [(student.grade, i, student) for i, student in "
469+
"enumerate(student_objects)]\n"
470+
">>> decorated.sort()\n"
471+
">>> [student for grade, i, student in decorated] # 移除裝飾\n"
472+
"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]"
439473

440474
#:../../howto/sorting.rst:231
441475
msgid""
@@ -532,7 +566,7 @@ msgstr ""
532566

533567
#:../../howto/sorting.rst:273
534568
msgid"sorted(words, key=cmp_to_key(strcoll)) # locale-aware sort order"
535-
msgstr""
569+
msgstr"sorted(words, key=cmp_to_key(strcoll)) # 理解語系的排序順序"
536570

537571
#:../../howto/sorting.rst:276
538572
msgid"Odds and Ends"
@@ -605,10 +639,10 @@ msgid ""
605639
"six comparison methods be implemented. The :func:`~functools.total_ordering` "
606640
"decorator is provided to make that task easier."
607641
msgstr""
608-
"然而,請注意,當 :meth:`~object.__lt__`沒有被實做時,``<`` 可以回退 (fall "
642+
"然而,請注意,當 :meth:`~object.__lt__`沒有被實作時,``<`` 可以回退 (fall "
609643
"back) 使用 :meth:`~object.__gt__`\\ (有關技術上的細節資訊請看 :func:`object."
610-
"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。裝飾"
611-
" :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。"
644+
"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。"
645+
"飾器 :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。"
612646

613647
#:../../howto/sorting.rst:314
614648
msgid""
@@ -672,7 +706,6 @@ msgid ""
672706
"position ``0``. These functions are suitable for implementing priority "
673707
"queues which are commonly used for task scheduling."
674708
msgstr""
675-
":func:`heapq.heappush` 和 :func:`heapq.heappop` 會建立並維持一個部份排序的資料"
676-
"排列,將最小的元素保持在位置 ``0``。這些函式適合用來實作常用於任務排程的優先"
677-
"佇列。"
678-
709+
":func:`heapq.heappush` 和 :func:`heapq.heappop` 會建立並維持一個部份排序的資"
710+
"料排列,將最小的元素保持在位置 ``0``。這些函式適合用來實作常用於任務排程的優"
711+
"先佇列。"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp