@@ -456,27 +456,36 @@ msgstr ""
456
456
457
457
#: ../../faq/design.rst:259
458
458
msgid "Why isn't there a switch or case statement in Python?"
459
- msgstr ""
459
+ msgstr "為什麼 Python 內沒有 switch 或 case 陳述式? "
460
460
461
461
#: ../../faq/design.rst:261
462
462
msgid ""
463
463
"You can do this easily enough with a sequence of ``if... elif... elif... "
464
464
"else``. For literal values, or constants within a namespace, you can also "
465
465
"use a ``match ... case`` statement."
466
466
msgstr ""
467
+ "你可以用一連串的 ``if... elif... elif... else`` 來輕易達成相同的效果。對於單"
468
+ "純的值或是在命名空間內的常數,你也可以使用 ``match ... case`` 陳述式。"
467
469
468
470
#: ../../faq/design.rst:265
469
471
msgid ""
470
472
"For cases where you need to choose from a very large number of "
471
473
"possibilities, you can create a dictionary mapping case values to functions "
472
474
"to call. For example::"
473
475
msgstr ""
476
+ "如果可能性很多,你可以用字典去映射要呼叫的函式。舉例來說:\n"
477
+ "\n"
478
+ "::"
474
479
475
480
#: ../../faq/design.rst:276
476
481
msgid ""
477
482
"For calling methods on objects, you can simplify yet further by using the :"
478
483
"func:`getattr` built-in to retrieve methods with a particular name::"
479
484
msgstr ""
485
+ "對於呼叫物件裡的方法,你可以利用內建用來找尋特定方法的函式 :func:`getattr` 來"
486
+ "做進一步的簡化:\n"
487
+ "\n"
488
+ "::"
480
489
481
490
#: ../../faq/design.rst:288
482
491
msgid ""
@@ -485,6 +494,8 @@ msgid ""
485
494
"from an untrusted source, an attacker would be able to call any method on "
486
495
"your object."
487
496
msgstr ""
497
+ "我們建議在方法名稱加上前綴,以這個例子來說是 像是 ``visit_``。沒有前綴的話,"
498
+ "一旦收到從不信任來源的值,攻擊者便可以隨意呼叫在你的專案內的方法。"
488
499
489
500
#: ../../faq/design.rst:294
490
501
msgid ""
0 commit comments