8000 Translate faq/design.html#why-don-t-generators-support-the-with-state… · python/python-docs-zh-tw@9448b4e · GitHub
[go: up one dir, main page]

Skip to content

Commit 9448b4e

Browse files
committed
Translate faq/design.html#why-don-t-generators-support-the-with-statement
1 parent 17d9539 commit 9448b4e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

faq/design.po

< 8000 div class="d-flex flex-items-center gap-1 pl-1">Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,7 @@ msgstr ""
12181218

12191219
#: ../../faq/design.rst:708
12201220
msgid "Why don't generators support the with statement?"
1221-
msgstr ""
1221+
msgstr "為何產生器 (generators) 不支援 with 陳述式?"
12221222

12231223
#: ../../faq/design.rst:710
12241224
msgid ""
@@ -1227,6 +1227,9 @@ msgid ""
12271227
"iterator run to completion, no closing is needed. When it is, wrap it as "
12281228
"\"contextlib.closing(generator)\" in the 'with' statement."
12291229
msgstr ""
1230+
"出於技術原因,把產生器直接用作上下文 (context) 管理器會無法正常運作。因為通常"
1231+
"來說,產生器是被當成迭代器 (iterator),到最後完成時不需要被手動關閉。但如果你"
1232+
"需要的話,你可以在 with 陳述式裡用「contextlib.closing(generator)」來包裝他。"
12301233

12311234
#: ../../faq/design.rst:717
12321235
msgid "Why are colons required for the if/while/def/class statements?"

0 commit comments

Comments
 (0)
0