-
-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy path2.3.po
More file actions
2506 lines (2182 loc) · 109 KB
/
2.3.po
File metadata and controls
2506 lines (2182 loc) · 109 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2024, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# ww song <[email protected]>, 2020
# Chang Ye <[email protected]>, 2020
# ppcfish <[email protected]>, 2020
# Naisen Xu <[email protected]>, 2020
# Freesand Leo <[email protected]>, 2024
# Rafael Fontenelle <[email protected]>, 2024
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.8\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-06 22:14+0000\n"
"PO-Revision-Date: 2020-05-30 12:17+0000\n"
"Last-Translator: Rafael Fontenelle <[email protected]>, 2024\n"
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../whatsnew/2.3.rst:3
msgid "What's New in Python 2.3"
msgstr "Python 2.3 有什么新变化"
#: ../../whatsnew/2.3.rst:0
msgid "Author"
msgstr "作者"
#: ../../whatsnew/2.3.rst:5
msgid "A.M. Kuchling"
msgstr "A.M. Kuchling"
#: ../../whatsnew/2.3.rst:11
msgid ""
"This article explains the new features in Python 2.3. Python 2.3 was "
"released on July 29, 2003."
msgstr "本文介绍了 Python 2.3 的新特性。 Python 2.3 发布于 2003 年 7 月 29 日。"
#: ../../whatsnew/2.3.rst:14
msgid ""
"The main themes for Python 2.3 are polishing some of the features added in "
"2.2, adding various small but useful enhancements to the core language, and "
"expanding the standard library. The new object model introduced in the "
"previous version has benefited from 18 months of bugfixes and from "
"optimization efforts that have improved the performance of new-style "
"classes. A few new built-in functions have been added such as :func:`sum` "
"and :func:`enumerate`. The :keyword:`in` operator can now be used for "
"substring searches (e.g. ``\"ab\" in \"abc\"`` returns :const:`True`)."
msgstr ""
"Python 2.3 的主要主题是完善在 2.2 中添加的一些功能、为核心语言添加各种小但实用的增强功能,以及扩展标准库。 "
"上一版本引入的新对象模型已经受益于 18 个月的错误修复和优化努力,这些优化提升了新式类的性能。 新增了几个内置函数,例如 :func:`sum` 和 "
":func:`enumerate`。 :keyword:`in` 操作符现在可以用于子字符串搜索 (例如,``\"ab\" in \"abc\"`` "
"将返回 :const:`True`)。"
#: ../../whatsnew/2.3.rst:23
msgid ""
"Some of the many new library features include Boolean, set, heap, and "
"date/time data types, the ability to import modules from ZIP-format "
"archives, metadata support for the long-awaited Python catalog, an updated "
"version of IDLE, and modules for logging messages, wrapping text, parsing "
"CSV files, processing command-line options, using BerkeleyDB databases... "
"the list of new and enhanced modules is lengthy."
msgstr ""
"许多新库功能包括布尔值、集合、堆、日期/时间数据类型,从ZIP格式的归档文件中导入模块的能力,期待已久的 Python 目录的元数据支持,更新版本的 "
"IDLE,以及用于日志记录、文本包装、解析 CSV 文件、处理命令行选项、使用 BerkeleyDB 数据库的模块…… 新模块和增强模块的列表相当长。"
#: ../../whatsnew/2.3.rst:30
msgid ""
"This article doesn't attempt to provide a complete specification of the new "
"features, but instead provides a convenient overview. For full details, you"
" should refer to the documentation for Python 2.3, such as the Python "
"Library Reference and the Python Reference Manual. If you want to "
"understand the complete implementation and design rationale, refer to the "
"PEP for a particular new feature."
msgstr ""
"本文并不试图提供对新功能的完整规范,而是提供了一个方便的概览。 有关详细信息,你应该参考 Python 2.3 的文档,例如 Python 库参考和 "
"Python 参考手册。 如果你想了解完整的实现和设计原理,请参阅特定新功能的 PEP。"
#: ../../whatsnew/2.3.rst:41
msgid "PEP 218: A Standard Set Datatype"
msgstr "PEP 218: 标准集合数据类型"
#: ../../whatsnew/2.3.rst:43
msgid ""
"The new :mod:`sets` module contains an implementation of a set datatype. "
"The :class:`Set` class is for mutable sets, sets that can have members added"
" and removed. The :class:`ImmutableSet` class is for sets that can't be "
"modified, and instances of :class:`ImmutableSet` can therefore be used as "
"dictionary keys. Sets are built on top of dictionaries, so the elements "
"within a set must be hashable."
msgstr ""
#: ../../whatsnew/2.3.rst:50
msgid "Here's a simple example::"
msgstr "这是一个简单的示例:"
#: ../../whatsnew/2.3.rst:66
msgid ""
"The union and intersection of sets can be computed with the :meth:`union` "
"and :meth:`intersection` methods; an alternative notation uses the bitwise "
"operators ``&`` and ``|``. Mutable sets also have in-place versions of these"
" methods, :meth:`union_update` and :meth:`intersection_update`. ::"
msgstr ""
#: ../../whatsnew/2.3.rst:86
msgid ""
"It's also possible to take the symmetric difference of two sets. This is "
"the set of all elements in the union that aren't in the intersection. "
"Another way of putting it is that the symmetric difference contains all "
"elements that are in exactly one set. Again, there's an alternative "
"notation (``^``), and an in-place version with the ungainly name "
":meth:`symmetric_difference_update`. ::"
msgstr ""
#: ../../whatsnew/2.3.rst:100
msgid ""
"There are also :meth:`issubset` and :meth:`issuperset` methods for checking "
"whether one set is a subset or superset of another::"
msgstr "另外还有 :meth:`issubset` 和 :meth:`issuperset` 方法用来检查一个集合是否为另一个集合的子集或超集::"
#: ../../whatsnew/2.3.rst:117
msgid ":pep:`218` - Adding a Built-In Set Object Type"
msgstr ":pep:`218` - 添加内置Set对象类型"
#: ../../whatsnew/2.3.rst:117
msgid ""
"PEP written by Greg V. Wilson. Implemented by Greg V. Wilson, Alex Martelli,"
" and GvR."
msgstr "PEP 由 Greg V. Wilson 撰写 ; 由 Greg V. Wilson, Alex Martelli 和 GvR 实现。"
#: ../../whatsnew/2.3.rst:126
msgid "PEP 255: Simple Generators"
msgstr "PEP 255: 简单的生成器"
#: ../../whatsnew/2.3.rst:128
msgid ""
"In Python 2.2, generators were added as an optional feature, to be enabled "
"by a ``from __future__ import generators`` directive. In 2.3 generators no "
"longer need to be specially enabled, and are now always present; this means "
"that :keyword:`yield` is now always a keyword. The rest of this section is "
"a copy of the description of generators from the \"What's New in Python "
"2.2\" document; if you read it back when Python 2.2 came out, you can skip "
"the rest of this section."
msgstr ""
"在 Python 2.2 中,生成器作为一个可选特性被添加,需要通过 ``from __future__ import generators`` "
"指令来启用。 在 2.3 版本中,生成器不再需要特别启用,现在总是存在;这意味着 :keyword:`yield` 现在始终是一个关键字。 "
"本节的其余部分是从《Python 2.2的新特性》文档中复制的生成器描述;如果你在 Python 2.2 发布时已经阅读过,可以跳过本节的其余部分。"
#: ../../whatsnew/2.3.rst:136
msgid ""
"You're doubtless familiar with how function calls work in Python or C. When "
"you call a function, it gets a private namespace where its local variables "
"are created. When the function reaches a :keyword:`return` statement, the "
"local variables are destroyed and the resulting value is returned to the "
"caller. A later call to the same function will get a fresh new set of local"
" variables. But, what if the local variables weren't thrown away on exiting "
"a function? What if you could later resume the function where it left off? "
"This is what generators provide; they can be thought of as resumable "
"functions."
msgstr ""
"你一定熟悉在 Python 或 C 语言中函数调用的工作方式。 当你调用一个函数时,它会获得一个私有命名空间,在这个命名空间中创建其局部变量。 "
"当函数执行到 :keyword:`return` 语句时,这些局部变量会被销毁,并将结果值返回给调用者。 "
"稍后对同一个函数的调用将获得一套全新的局部变量。 "
"但是,如果局部变量在函数退出时不被丢弃呢?如果你可以在函数停止的地方稍后恢复执行呢?这就是生成器所提供的功能;它们可以被视为可恢复的函数。"
#: ../../whatsnew/2.3.rst:145
msgid "Here's the simplest example of a generator function::"
msgstr "这里是一个生成器函数的最简示例::"
#: ../../whatsnew/2.3.rst:151
msgid ""
"A new keyword, :keyword:`yield`, was introduced for generators. Any "
"function containing a :keyword:`!yield` statement is a generator function; "
"this is detected by Python's bytecode compiler which compiles the function "
"specially as a result."
msgstr ""
"一个新的关键字 :keyword:`yield` 被引入用于生成器。 任何包含 :keyword:`!yield` 语句的函数都是生成器函数;这由 "
"Python 的字节码编译器检测到,并因此对函数进行特殊编译。"
#: ../../whatsnew/2.3.rst:156
msgid ""
"When you call a generator function, it doesn't return a single value; "
"instead it returns a generator object that supports the iterator protocol. "
"On executing the :keyword:`yield` statement, the generator outputs the value"
" of ``i``, similar to a :keyword:`return` statement. The big difference "
"between :keyword:`!yield` and a :keyword:`!return` statement is that on "
"reaching a :keyword:`!yield` the generator's state of execution is suspended"
" and local variables are preserved. On the next call to the generator's "
"``.next()`` method, the function will resume executing immediately after the"
" :keyword:`!yield` statement. (For complicated reasons, the "
":keyword:`!yield` statement isn't allowed inside the :keyword:`try` block of"
" a :keyword:`!try`...\\ :keyword:`!finally` statement; read :pep:`255` for a"
" full explanation of the interaction between :keyword:`!yield` and "
"exceptions.)"
msgstr ""
#: ../../whatsnew/2.3.rst:169
msgid "Here's a sample usage of the :func:`generate_ints` generator::"
msgstr "这里是 :func:`generate_ints` 生成器的用法示例::"
#: ../../whatsnew/2.3.rst:186
msgid ""
"You could equally write ``for i in generate_ints(5)``, or ``a,b,c = "
"generate_ints(3)``."
msgstr ""
"你可以等价地写成 ``for i in generate_ints(5)`` 或 ``a,b,c = generate_ints(3)``。"
#: ../../whatsnew/2.3.rst:189
msgid ""
"Inside a generator function, the :keyword:`return` statement can only be "
"used without a value, and signals the end of the procession of values; "
"afterwards the generator cannot return any further values. "
":keyword:`!return` with a value, such as ``return 5``, is a syntax error "
"inside a generator function. The end of the generator's results can also be"
" indicated by raising :exc:`StopIteration` manually, or by just letting the "
"flow of execution fall off the bottom of the function."
msgstr ""
"在生成器函数内部, :keyword:`return` "
"语句只能不带值使用,并表示值的生成过程结束;之后,生成器不能再返回任何值。在生成器函数内部,带值的 :keyword:`!return`,例如 "
"``return 5``,是语法错误。生成器结果的结束也可以通过手动引发 :exc:`StopIteration` "
"异常来指示,或者只是让执行流自然地从函数底部流出。"
#: ../../whatsnew/2.3.rst:197
msgid ""
"You could achieve the effect of generators manually by writing your own "
"class and storing all the local variables of the generator as instance "
"variables. For example, returning a list of integers could be done by "
"setting ``self.count`` to 0, and having the :meth:`next` method increment "
"``self.count`` and return it. However, for a moderately complicated "
"generator, writing a corresponding class would be much messier. "
":file:`Lib/test/test_generators.py` contains a number of more interesting "
"examples. The simplest one implements an in-order traversal of a tree using"
" generators recursively. ::"
msgstr ""
"你可以通过编写自己的类并将生成器的所有局部变量存储为实例变量,手动实现生成器的效果。例如,返回一个整数列表可以通过将 ``self.count`` "
"设置为0,并让 :meth:`next` 方法递增 ``self.count`` "
"并返回它。然而,对于一个中等复杂的生成器,编写一个相应的类将会更加混乱。:file:`Lib/test/test_generators.py` "
"包含了一些更有趣的例子。其中最简单的一个使用生成器递归实现了树的中序遍历:"
#: ../../whatsnew/2.3.rst:215
msgid ""
"Two other examples in :file:`Lib/test/test_generators.py` produce solutions "
"for the N-Queens problem (placing $N$ queens on an $NxN$ chess board so that"
" no queen threatens another) and the Knight's Tour (a route that takes a "
"knight to every square of an $NxN$ chessboard without visiting any square "
"twice)."
msgstr ""
"在 :file:`Lib/test/test_generators.py` "
"中还有另外两个例子,它们分别解决了N皇后问题(在$NxN$的棋盘上放置$N$个皇后,使得没有任何皇后威胁到其他皇后)和骑士巡游问题(在$NxN$的棋盘上,骑士访问每一个方格且不重复访问任何方格的路径)。"
#: ../../whatsnew/2.3.rst:220
msgid ""
"The idea of generators comes from other programming languages, especially "
"Icon (https://www.cs.arizona.edu/icon/), where the idea of generators is "
"central. In Icon, every expression and function call behaves like a "
"generator. One example from \"An Overview of the Icon Programming "
"Language\" at https://www.cs.arizona.edu/icon/docs/ipd266.htm gives an idea "
"of what this looks like::"
msgstr ""
#: ../../whatsnew/2.3.rst:230
msgid ""
"In Icon the :func:`find` function returns the indexes at which the substring"
" \"or\" is found: 3, 23, 33. In the :keyword:`if` statement, ``i`` is first"
" assigned a value of 3, but 3 is less than 5, so the comparison fails, and "
"Icon retries it with the second value of 23. 23 is greater than 5, so the "
"comparison now succeeds, and the code prints the value 23 to the screen."
msgstr ""
#: ../../whatsnew/2.3.rst:236
msgid ""
"Python doesn't go nearly as far as Icon in adopting generators as a central "
"concept. Generators are considered part of the core Python language, but "
"learning or using them isn't compulsory; if they don't solve any problems "
"that you have, feel free to ignore them. One novel feature of Python's "
"interface as compared to Icon's is that a generator's state is represented "
"as a concrete object (the iterator) that can be passed around to other "
"functions or stored in a data structure."
msgstr ""
#: ../../whatsnew/2.3.rst:248
msgid ":pep:`255` - Simple Generators"
msgstr ":pep:`255` - 简单生成器"
#: ../../whatsnew/2.3.rst:248
msgid ""
"Written by Neil Schemenauer, Tim Peters, Magnus Lie Hetland. Implemented "
"mostly by Neil Schemenauer and Tim Peters, with other fixes from the Python "
"Labs crew."
msgstr ""
"由 Neil Schemenauer, Tim Peters, Magnus Lie Hetland 撰写。 主要由 Neil Schemenauer "
"和 Tim Peters 实现,并包含来自 Python Labs 团队的修正。"
#: ../../whatsnew/2.3.rst:257
msgid "PEP 263: Source Code Encodings"
msgstr "PEP 263: 源代码的字符编码格式"
#: ../../whatsnew/2.3.rst:259
msgid ""
"Python source files can now be declared as being in different character set "
"encodings. Encodings are declared by including a specially formatted "
"comment in the first or second line of the source file. For example, a "
"UTF-8 file can be declared with::"
msgstr ""
#: ../../whatsnew/2.3.rst:267
msgid ""
"Without such an encoding declaration, the default encoding used is 7-bit "
"ASCII. Executing or importing modules that contain string literals with "
"8-bit characters and have no encoding declaration will result in a "
":exc:`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will be"
" a syntax error."
msgstr ""
#: ../../whatsnew/2.3.rst:273
msgid ""
"The encoding declaration only affects Unicode string literals, which will be"
" converted to Unicode using the specified encoding. Note that Python "
"identifiers are still restricted to ASCII characters, so you can't have "
"variable names that use characters outside of the usual alphanumerics."
msgstr ""
#: ../../whatsnew/2.3.rst:282
msgid ":pep:`263` - Defining Python Source Code Encodings"
msgstr ":pep:`263` - 定义 Python 源代码的编码格式"
#: ../../whatsnew/2.3.rst:282
msgid ""
"Written by Marc-André Lemburg and Martin von Löwis; implemented by Suzuki "
"Hisao and Martin von Löwis."
msgstr ""
"由 Marc-André Lemburg 和 Martin von Löwis 撰写 ; 由 Suzuki Hisao 和 Martin von "
"Löwis 实现。"
#: ../../whatsnew/2.3.rst:289
msgid "PEP 273: Importing Modules from ZIP Archives"
msgstr "PEP 273: 从ZIP压缩包导入模块"
#: ../../whatsnew/2.3.rst:291
msgid ""
"The new :mod:`zipimport` module adds support for importing modules from a "
"ZIP-format archive. You don't need to import the module explicitly; it will"
" be automatically imported if a ZIP archive's filename is added to "
"``sys.path``. For example:"
msgstr ""
#: ../../whatsnew/2.3.rst:314
msgid ""
"An entry in ``sys.path`` can now be the filename of a ZIP archive. The ZIP "
"archive can contain any kind of files, but only files named :file:`\\*.py`, "
":file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. If an archive only "
"contains :file:`\\*.py` files, Python will not attempt to modify the archive"
" by adding the corresponding :file:`\\*.pyc` file, meaning that if a ZIP "
"archive doesn't contain :file:`\\*.pyc` files, importing may be rather slow."
msgstr ""
#: ../../whatsnew/2.3.rst:321
msgid ""
"A path within the archive can also be specified to only import from a "
"subdirectory; for example, the path :file:`/tmp/example.zip/lib/` would only"
" import from the :file:`lib/` subdirectory within the archive."
msgstr ""
#: ../../whatsnew/2.3.rst:331
msgid ":pep:`273` - Import Modules from Zip Archives"
msgstr ":pep:`273` - 从 ZIP 压缩包导入模块"
#: ../../whatsnew/2.3.rst:329
msgid ""
"Written by James C. Ahlstrom, who also provided an implementation. Python "
"2.3 follows the specification in :pep:`273`, but uses an implementation "
"written by Just van Rossum that uses the import hooks described in "
":pep:`302`. See section :ref:`section-pep302` for a description of the new "
"import hooks."
msgstr ""
#: ../../whatsnew/2.3.rst:338
msgid "PEP 277: Unicode file name support for Windows NT"
msgstr "PEP 277: 针对 Windows NT 的 Unicode 文件名支持"
#: ../../whatsnew/2.3.rst:340
msgid ""
"On Windows NT, 2000, and XP, the system stores file names as Unicode "
"strings. Traditionally, Python has represented file names as byte strings, "
"which is inadequate because it renders some file names inaccessible."
msgstr ""
#: ../../whatsnew/2.3.rst:344
msgid ""
"Python now allows using arbitrary Unicode strings (within the limitations of"
" the file system) for all functions that expect file names, most notably the"
" :func:`open` built-in function. If a Unicode string is passed to "
":func:`os.listdir`, Python now returns a list of Unicode strings. A new "
"function, :func:`os.getcwdu`, returns the current directory as a Unicode "
"string."
msgstr ""
#: ../../whatsnew/2.3.rst:350
msgid ""
"Byte strings still work as file names, and on Windows Python will "
"transparently convert them to Unicode using the ``mbcs`` encoding."
msgstr "字节串仍可被用作文件名,并且在 Windows 上 Python 将透明地使用 ``mbcs`` 编码格式将其转换为 Unicode。"
#: ../../whatsnew/2.3.rst:353
msgid ""
"Other systems also allow Unicode strings as file names but convert them to "
"byte strings before passing them to the system, which can cause a "
":exc:`UnicodeError` to be raised. Applications can test whether arbitrary "
"Unicode strings are supported as file names by checking "
":attr:`os.path.supports_unicode_filenames`, a Boolean value."
msgstr ""
#: ../../whatsnew/2.3.rst:359
msgid "Under MacOS, :func:`os.listdir` may now return Unicode filenames."
msgstr "在 MacOS 下,:func:`os.listdir` 现在可以返回 Unicode 文件名。"
#: ../../whatsnew/2.3.rst:365
msgid ":pep:`277` - Unicode file name support for Windows NT"
msgstr ":pep:`277` - 针对 Windows NT 的 Unicode 文件名支持"
#: ../../whatsnew/2.3.rst:365
msgid ""
"Written by Neil Hodgson; implemented by Neil Hodgson, Martin von Löwis, and "
"Mark Hammond."
msgstr ""
"由 Neil Hodgson 撰写 ; 由 Neil Hodgson, Martin von Löwis 和 Mark Hammond 实现。"
#: ../../whatsnew/2.3.rst:375
msgid "PEP 278: Universal Newline Support"
msgstr "PEP 278: 通用换行支持"
#: ../../whatsnew/2.3.rst:377
msgid ""
"The three major operating systems used today are Microsoft Windows, Apple's "
"Macintosh OS, and the various Unix derivatives. A minor irritation of "
"cross-platform work is that these three platforms all use different "
"characters to mark the ends of lines in text files. Unix uses the linefeed "
"(ASCII character 10), MacOS uses the carriage return (ASCII character 13), "
"and Windows uses a two-character sequence of a carriage return plus a "
"newline."
msgstr ""
"目前使用的三大操作系统是微软的 Windows、苹果的 Macintosh OS 和各种 Unix "
"衍生系统。跨平台工作的一个小麻烦是,这三个平台都使用不同的字符来标记文本文件中的行结束。Unix 使用换行符(ASCII 字符 10),MacOS "
"使用回车符(ASCII 字符 13),Windows 使用回车符加换行符的双字符序列。"
#: ../../whatsnew/2.3.rst:384
msgid ""
"Python's file objects can now support end of line conventions other than the"
" one followed by the platform on which Python is running. Opening a file "
"with the mode ``'U'`` or ``'rU'`` will open a file for reading in "
":term:`universal newlines` mode. All three line ending conventions will be "
"translated to a ``'\\n'`` in the strings returned by the various file "
"methods such as :meth:`read` and :meth:`readline`."
msgstr ""
#: ../../whatsnew/2.3.rst:391
msgid ""
"Universal newline support is also used when importing modules and when "
"executing a file with the :func:`execfile` function. This means that Python"
" modules can be shared between all three operating systems without needing "
"to convert the line-endings."
msgstr ""
#: ../../whatsnew/2.3.rst:396
msgid ""
"This feature can be disabled when compiling Python by specifying the "
":option:`!--without-universal-newlines` switch when running Python's "
":program:`configure` script."
msgstr ""
"在编译 Python 时,可以通过在运行 Python 的 :program:`configure` 脚本时指定 :option:`!--"
"without-universal-newlines` 开关禁用该功能。"
#: ../../whatsnew/2.3.rst:403
msgid ":pep:`278` - Universal Newline Support"
msgstr ":pep:`278` - 通用换行支持"
#: ../../whatsnew/2.3.rst:404
msgid "Written and implemented by Jack Jansen."
msgstr "由 Jack Jansen 撰写并实现。"
#: ../../whatsnew/2.3.rst:412
msgid "PEP 279: enumerate()"
msgstr "PEP 279: enumerate()"
#: ../../whatsnew/2.3.rst:414
msgid ""
"A new built-in function, :func:`enumerate`, will make certain loops a bit "
"clearer. ``enumerate(thing)``, where *thing* is either an iterator or a "
"sequence, returns an iterator that will return ``(0, thing[0])``, ``(1, "
"thing[1])``, ``(2, thing[2])``, and so forth."
msgstr ""
"新的内置函数 :func:`enumerate` 将使某些循环更加清晰。 在 ``enumerate(thing)`` 中,如果 *thing* "
"是迭代器或序列,则返回一个迭代器,该迭代器将返回 ``(0, thing[0])``,``(1, thing[1])``,``(2, "
"thing[2])``,以此类推。"
#: ../../whatsnew/2.3.rst:419
msgid "A common idiom to change every element of a list looks like this::"
msgstr "改变一个列表中每个元素的常见写法看起来像是这样::"
#: ../../whatsnew/2.3.rst:426
msgid "This can be rewritten using :func:`enumerate` as::"
msgstr "可以使用 :func:`enumerate` 重写为:"
#: ../../whatsnew/2.3.rst:435
msgid ":pep:`279` - The enumerate() built-in function"
msgstr ":pep:`279` - 内置函数 enumerate()"
#: ../../whatsnew/2.3.rst:436
msgid "Written and implemented by Raymond D. Hettinger."
msgstr "由 Raymond D. Hettinger 撰写并实现。"
#: ../../whatsnew/2.3.rst:442
msgid "PEP 282: The logging Package"
msgstr "PEP 282: logging 包"
#: ../../whatsnew/2.3.rst:444
msgid ""
"A standard package for writing logs, :mod:`logging`, has been added to "
"Python 2.3. It provides a powerful and flexible mechanism for generating "
"logging output which can then be filtered and processed in various ways. A "
"configuration file written in a standard format can be used to control the "
"logging behavior of a program. Python includes handlers that will write log"
" records to standard error or to a file or socket, send them to the system "
"log, or even e-mail them to a particular address; of course, it's also "
"possible to write your own handler classes."
msgstr ""
"Python 2.3 中新增了一个用于编写日志的标准软件包 :mod:`logging`。 "
"它为生成日志输出提供了一个强大而灵活的机制,这些输出可以通过各种方式进行过滤和处理。用标准格式编写的配置文件可以用来控制程序的日志行为。 Python "
"包含的处理器可以将日志记录写入标准错误、文件或套接字,发送到系统日志,甚至通过电子邮件发送到特定地址;当然,您也可以编写自己的处理器类。"
#: ../../whatsnew/2.3.rst:453
msgid ""
"The :class:`Logger` class is the primary class. Most application code will "
"deal with one or more :class:`Logger` objects, each one used by a particular"
" subsystem of the application. Each :class:`Logger` is identified by a name,"
" and names are organized into a hierarchy using ``.`` as the component "
"separator. For example, you might have :class:`Logger` instances named "
"``server``, ``server.auth`` and ``server.network``. The latter two "
"instances are below ``server`` in the hierarchy. This means that if you "
"turn up the verbosity for ``server`` or direct ``server`` messages to a "
"different handler, the changes will also apply to records logged to "
"``server.auth`` and ``server.network``. There's also a root :class:`Logger` "
"that's the parent of all other loggers."
msgstr ""
#: ../../whatsnew/2.3.rst:464
msgid ""
"For simple uses, the :mod:`logging` package contains some convenience "
"functions that always use the root log::"
msgstr "为了简化使用,:mod:`logging` 包提供了一些始终使用根日志的便捷函数::"
#: ../../whatsnew/2.3.rst:475 ../../whatsnew/2.3.rst:500
msgid "This produces the following output::"
msgstr "这会产生以下输出::"
#: ../../whatsnew/2.3.rst:481
msgid ""
"In the default configuration, informational and debugging messages are "
"suppressed and the output is sent to standard error. You can enable the "
"display of informational and debugging messages by calling the "
":meth:`setLevel` method on the root logger."
msgstr ""
#: ../../whatsnew/2.3.rst:486
msgid ""
"Notice the :func:`warning` call's use of string formatting operators; all of"
" the functions for logging messages take the arguments ``(msg, arg1, arg2, "
"...)`` and log the string resulting from ``msg % (arg1, arg2, ...)``."
msgstr ""
#: ../../whatsnew/2.3.rst:490
msgid ""
"There's also an :func:`exception` function that records the most recent "
"traceback. Any of the other functions will also record the traceback if you"
" specify a true value for the keyword argument *exc_info*. ::"
msgstr ""
#: ../../whatsnew/2.3.rst:508
msgid ""
"Slightly more advanced programs will use a logger other than the root "
"logger. The ``getLogger(name)`` function is used to get a particular log, "
"creating it if it doesn't exist yet. ``getLogger(None)`` returns the root "
"logger. ::"
msgstr ""
#: ../../whatsnew/2.3.rst:519
msgid ""
"Log records are usually propagated up the hierarchy, so a message logged to "
"``server.auth`` is also seen by ``server`` and ``root``, but a "
":class:`Logger` can prevent this by setting its :attr:`propagate` attribute "
"to :const:`False`."
msgstr ""
#: ../../whatsnew/2.3.rst:523
msgid ""
"There are more classes provided by the :mod:`logging` package that can be "
"customized. When a :class:`Logger` instance is told to log a message, it "
"creates a :class:`LogRecord` instance that is sent to any number of "
"different :class:`Handler` instances. Loggers and handlers can also have an"
" attached list of filters, and each filter can cause the :class:`LogRecord` "
"to be ignored or can modify the record before passing it along. When "
"they're finally output, :class:`LogRecord` instances are converted to text "
"by a :class:`Formatter` class. All of these classes can be replaced by your"
" own specially-written classes."
msgstr ""
#: ../../whatsnew/2.3.rst:533
msgid ""
"With all of these features the :mod:`logging` package should provide enough "
"flexibility for even the most complicated applications. This is only an "
"incomplete overview of its features, so please see the package's reference "
"documentation for all of the details. Reading :pep:`282` will also be "
"helpful."
msgstr ""
":mod:`logging` 软件包具有所有这些功能,即使是最复杂的应用程序也能灵活运用。 "
"本文仅是对其功能的不完整概述,因此请参阅软件包的参考文档了解所有细节。 阅读 :pep:`282` 也会有所帮助。"
#: ../../whatsnew/2.3.rst:541
msgid ":pep:`282` - A Logging System"
msgstr ":pep:`282` - Logging 系统"
#: ../../whatsnew/2.3.rst:542
msgid "Written by Vinay Sajip and Trent Mick; implemented by Vinay Sajip."
msgstr "由 Vinay Sajip 和 Trent Mick 撰写 ; 由 Vinay Sajip 实现。"
#: ../../whatsnew/2.3.rst:550
msgid "PEP 285: A Boolean Type"
msgstr "PEP 285: 布尔类型"
#: ../../whatsnew/2.3.rst:552
msgid ""
"A Boolean type was added to Python 2.3. Two new constants were added to the"
" :mod:`__builtin__` module, :const:`True` and :const:`False`. "
"(:const:`True` and :const:`False` constants were added to the built-ins in "
"Python 2.2.1, but the 2.2.1 versions are simply set to integer values of 1 "
"and 0 and aren't a different type.)"
msgstr ""
#: ../../whatsnew/2.3.rst:558
msgid ""
"The type object for this new type is named :class:`bool`; the constructor "
"for it takes any Python value and converts it to :const:`True` or "
":const:`False`. ::"
msgstr ""
"这个新类型的类型对象名为 :class:`bool`;它的构造函数接收任何 Python 值,并将其转换为 :const:`True` 或 "
":const:`False`。::"
#: ../../whatsnew/2.3.rst:570
msgid ""
"Most of the standard library modules and built-in functions have been "
"changed to return Booleans. ::"
msgstr "大多数标准库模块和内置函数都改为返回布尔值:"
#: ../../whatsnew/2.3.rst:581
msgid ""
"Python's Booleans were added with the primary goal of making code clearer. "
"For example, if you're reading a function and encounter the statement "
"``return 1``, you might wonder whether the ``1`` represents a Boolean truth "
"value, an index, or a coefficient that multiplies some other quantity. If "
"the statement is ``return True``, however, the meaning of the return value "
"is quite clear."
msgstr ""
"添加 Python 布尔运算的主要目的是使代码更清晰。 例如,如果您在阅读一个函数时遇到 ``return 1`` 语句,您可能会想知道 ``1`` "
"代表的是布尔真值、索引还是乘以其他量的系数。 然而,如果语句是 ``return True``,返回值的含义就非常清楚了。"
#: ../../whatsnew/2.3.rst:587
msgid ""
"Python's Booleans were *not* added for the sake of strict type-checking. A "
"very strict language such as Pascal would also prevent you performing "
"arithmetic with Booleans, and would require that the expression in an "
":keyword:`if` statement always evaluate to a Boolean result. Python is not "
"this strict and never will be, as :pep:`285` explicitly says. This means "
"you can still use any expression in an :keyword:`!if` statement, even ones "
"that evaluate to a list or tuple or some random object. The Boolean type is"
" a subclass of the :class:`int` class so that arithmetic using a Boolean "
"still works. ::"
msgstr ""
"Python 的布尔值 *不是* 为了严格的类型检查而添加的。 像 Pascal 这样非常严格的语言也会阻止您使用布尔进行算术运算,并要求 "
":keyword:`if` 语句中的表达式总是求布尔结果。 正如 :pep:`285` 所明确指出的,Python 没有这么严格,以后也不会有。 "
"这意味着您仍然可以在 :keyword:`!if` 语句中使用任何表达式,甚至是求值为 list、tuple 或一些随机对象的表达式。 布尔类型是 "
":class:`int` 类的子类,因此使用布尔值进行算术运算仍然有效:"
#: ../../whatsnew/2.3.rst:605
msgid ""
"To sum up :const:`True` and :const:`False` in a sentence: they're "
"alternative ways to spell the integer values 1 and 0, with the single "
"difference that :func:`str` and :func:`repr` return the strings ``'True'`` "
"and ``'False'`` instead of ``'1'`` and ``'0'``."
msgstr ""
"用一句话概括 :const:`True` 和 :const:`False`: 它们是拼写整数值 1 和 0 的另一种方式,唯一不同的是 "
":func:`str` 和 :func:`repr` 返回的字符串是 ``'True'`` 和 ``'False'``,而不是 ``'1'`` 和 "
"``'0'``。"
#: ../../whatsnew/2.3.rst:613
msgid ":pep:`285` - Adding a bool type"
msgstr ":pep:`285` - 添加布尔类型"
#: ../../whatsnew/2.3.rst:614
msgid "Written and implemented by GvR."
msgstr "由 GvR 撰写并实现。"
#: ../../whatsnew/2.3.rst:620
msgid "PEP 293: Codec Error Handling Callbacks"
msgstr "PEP 293: 编解码器错误处理回调"
#: ../../whatsnew/2.3.rst:622
msgid ""
"When encoding a Unicode string into a byte string, unencodable characters "
"may be encountered. So far, Python has allowed specifying the error "
"processing as either \"strict\" (raising :exc:`UnicodeError`), \"ignore\" "
"(skipping the character), or \"replace\" (using a question mark in the "
"output string), with \"strict\" being the default behavior. It may be "
"desirable to specify alternative processing of such errors, such as "
"inserting an XML character reference or HTML entity reference into the "
"converted string."
msgstr ""
"将 Unicode 字符串编码为字节字符串时,可能会遇到无法编码的字符。 到目前为止,Python 允许将错误处理指定为 \"strict\" (引发 "
":exc:`UnicodeError`)、\"ignore\" (跳过该字符) 或 \"replace\" (在输出字符串中使用问号),其中 "
"\"strict\" 是默认行为。 可能需要指定对此类错误的其他处理方式,例如在转换后的字符串中插入 XML 字符引用或 HTML 实体引用。"
#: ../../whatsnew/2.3.rst:630
msgid ""
"Python now has a flexible framework to add different processing strategies."
" New error handlers can be added with :func:`codecs.register_error`, and "
"codecs then can access the error handler with :func:`codecs.lookup_error`. "
"An equivalent C API has been added for codecs written in C. The error "
"handler gets the necessary state information such as the string being "
"converted, the position in the string where the error was detected, and the "
"target encoding. The handler can then either raise an exception or return a"
" replacement string."
msgstr ""
"Python 现在有一个灵活的框架,可以添加不同的处理策略。可以通过 :func:`codecs.register_error` "
"添加新的错误处理器,然后编解码器可以通过 :func:`codecs.lookup_error` 访问错误处理器。 "
"错误处理器会获取必要的状态信息,如正在转换的字符串、字符串中检测到错误的位置以及目标编码。 然后,处理器可以引发异常或返回替换字符串。"
#: ../../whatsnew/2.3.rst:638
msgid ""
"Two additional error handlers have been implemented using this framework: "
"\"backslashreplace\" uses Python backslash quoting to represent unencodable "
"characters and \"xmlcharrefreplace\" emits XML character references."
msgstr ""
"使用该框架还实现了两个额外的错误处理器: \"backslashreplace\" 使用 Python 反斜杠引号来表示无法编码的字符,而 "
"\"xmlcharrefreplace\" 则转换为 XML 字符引用。"
#: ../../whatsnew/2.3.rst:645
msgid ":pep:`293` - Codec Error Handling Callbacks"
msgstr ":pep:`293` - 编解码器错误处理回调"
#: ../../whatsnew/2.3.rst:646
msgid "Written and implemented by Walter Dörwald."
msgstr "由 Walter Dörwald 撰写并实现。"
#: ../../whatsnew/2.3.rst:654
msgid "PEP 301: Package Index and Metadata for Distutils"
msgstr "PEP 301: Distutils的软件包索引和元数据"
#: ../../whatsnew/2.3.rst:656
msgid ""
"Support for the long-requested Python catalog makes its first appearance in "
"2.3."
msgstr "广受期待的对 Python 编目的支持在 2.3 版中首次出现。"
#: ../../whatsnew/2.3.rst:658
msgid ""
"The heart of the catalog is the new Distutils :command:`register` command. "
"Running ``python setup.py register`` will collect the metadata describing a "
"package, such as its name, version, maintainer, description, &c., and send "
"it to a central catalog server. The resulting catalog is available from "
"https://pypi.org."
msgstr ""
"编目功能的核心是新的 Distutils :command:`register` 命令。 运行 ``python setup.py register``"
" 将会收集描述软件包的元数据,例如其名称、版本、维护者、描述信息等等,并将其发送给中央编目服务器。 结果编目数据可在 https://pypi.org "
"获取。"
#: ../../whatsnew/2.3.rst:664
msgid ""
"To make the catalog a bit more useful, a new optional *classifiers* keyword "
"argument has been added to the Distutils :func:`setup` function. A list of "
"`Trove <http://catb.org/~esr/trove/>`_-style strings can be supplied to help"
" classify the software."
msgstr ""
#: ../../whatsnew/2.3.rst:669
msgid ""
"Here's an example :file:`setup.py` with classifiers, written to be "
"compatible with older versions of the Distutils::"
msgstr "下面是一个带有分类器的 :file:`setup.py` 示例,其编写是为了兼容旧版本的 Distutils:"
#: ../../whatsnew/2.3.rst:688
msgid ""
"The full list of classifiers can be obtained by running ``python setup.py "
"register --list-classifiers``."
msgstr ""
"完整的 classifiers 列表可通过运行 ``python setup.py register --list-classifiers`` 来获取。"
#: ../../whatsnew/2.3.rst:694
msgid ":pep:`301` - Package Index and Metadata for Distutils"
msgstr ":pep:`301` - Distutils 的软件包索引和元数据"
#: ../../whatsnew/2.3.rst:695
msgid "Written and implemented by Richard Jones."
msgstr "由 Richard Jones 撰写并实现。"
#: ../../whatsnew/2.3.rst:703
msgid "PEP 302: New Import Hooks"
msgstr "PEP 302: 新导入钩子"
#: ../../whatsnew/2.3.rst:705
msgid ""
"While it's been possible to write custom import hooks ever since the "
":mod:`ihooks` module was introduced in Python 1.3, no one has ever been "
"really happy with it because writing new import hooks is difficult and "
"messy. There have been various proposed alternatives such as the "
":mod:`imputil` and :mod:`iu` modules, but none of them has ever gained much "
"acceptance, and none of them were easily usable from C code."
msgstr ""
#: ../../whatsnew/2.3.rst:712
msgid ""
":pep:`302` borrows ideas from its predecessors, especially from Gordon "
"McMillan's :mod:`iu` module. Three new items are added to the :mod:`sys` "
"module:"
msgstr ""
#: ../../whatsnew/2.3.rst:716
msgid ""
"``sys.path_hooks`` is a list of callable objects; most often they'll be "
"classes. Each callable takes a string containing a path and either returns "
"an importer object that will handle imports from this path or raises an "
":exc:`ImportError` exception if it can't handle this path."
msgstr ""
"``sys.path_hooks`` 是一个可调用对象列表,通常是类。 "
"每个可调用对象都接收一个包含路径的字符串,然后返回一个可处理从该路径导入的导入器对象,如果不能处理该路径,则引发 :exc:`ImportError` "
"异常。"
#: ../../whatsnew/2.3.rst:721
msgid ""
"``sys.path_importer_cache`` caches importer objects for each path, so "
"``sys.path_hooks`` will only need to be traversed once for each path."
msgstr ""
"``sys.path_importer_cache`` 会缓存每条路径的导入器对象,因此 ``sys.path_hooks`` 只需为每条路径遍历一次。"
" "
#: ../../whatsnew/2.3.rst:724
msgid ""
"``sys.meta_path`` is a list of importer objects that will be traversed "
"before ``sys.path`` is checked. This list is initially empty, but user code"
" can add objects to it. Additional built-in and frozen modules can be "
"imported by an object added to this list."
msgstr ""
"``sys.meta_path`` 是一个导入器对象列表,在检查 ``sys.path`` 之前将遍历该列表。 "
"该列表最初为空,但用户代码可以向其中添加对象。 其他内置模块和冻结模块可以通过添加到该列表中的对象导入。"
#: ../../whatsnew/2.3.rst:729
msgid ""
"Importer objects must have a single method, ``find_module(fullname, "
"path=None)``. *fullname* will be a module or package name, e.g. ``string`` "
"or ``distutils.core``. :meth:`find_module` must return a loader object that"
" has a single method, ``load_module(fullname)``, that creates and returns "
"the corresponding module object."
msgstr ""
#: ../../whatsnew/2.3.rst:735
msgid ""
"Pseudo-code for Python's new import logic, therefore, looks something like "
"this (simplified a bit; see :pep:`302` for the full details)::"
msgstr "因此,Python 新导入逻辑的伪代码如下 (略有简化;详情请参见 :pep:`302`):"
#: ../../whatsnew/2.3.rst:760
msgid ":pep:`302` - New Import Hooks"
msgstr ":pep:`302` - 新导入钩"
#: ../../whatsnew/2.3.rst:761
msgid ""
"Written by Just van Rossum and Paul Moore. Implemented by Just van Rossum."
msgstr "由 Just van Rossum 和 Paul Moore 撰写 ; 由 Just van Rossum 实现。"
#: ../../whatsnew/2.3.rst:769
msgid "PEP 305: Comma-separated Files"
msgstr "PEP 305: 逗号分隔文件"
#: ../../whatsnew/2.3.rst:771
msgid ""
"Comma-separated files are a format frequently used for exporting data from "
"databases and spreadsheets. Python 2.3 adds a parser for comma-separated "
"files."
msgstr "以逗号作为分隔符的文件是一种常用于从数据库和电子表格导出数据的格式。 Python 2.3 增加了一个针对逗号分隔文件的解析器。"
#: ../../whatsnew/2.3.rst:774
msgid "Comma-separated format is deceptively simple at first glance::"
msgstr "逗号分隔文件乍一看非常简单::"
#: ../../whatsnew/2.3.rst:778
msgid ""
"Read a line and call ``line.split(',')``: what could be simpler? But toss in"
" string data that can contain commas, and things get more complicated::"
msgstr "读取一行并调用 ``line.split(',')``: 再简单不过了吧? 但是考虑到可能包含逗号的字符串数据,事件就变得复杂起来::"
#: ../../whatsnew/2.3.rst:783
msgid ""
"A big ugly regular expression can parse this, but using the new :mod:`csv` "
"package is much simpler::"
msgstr "一个大的丑陋的正则表达式可以解析这些内容,但使用新的 :mod:`csv` 软件包要简单得多:"
#: ../../whatsnew/2.3.rst:793
msgid ""
"The :func:`reader` function takes a number of different options. The field "
"separator isn't limited to the comma and can be changed to any character, "
"and so can the quoting and line-ending characters."
msgstr ""
#: ../../whatsnew/2.3.rst:797
msgid ""
"Different dialects of comma-separated files can be defined and registered; "
"currently there are two dialects, both used by Microsoft Excel. A separate "
":class:`csv.writer` class will generate comma-separated files from a "
"succession of tuples or lists, quoting strings that contain the delimiter."
msgstr ""
#: ../../whatsnew/2.3.rst:806
msgid ":pep:`305` - CSV File API"
msgstr "该实现在“Python 增强提议” - PEP `305` (CSV 文件 API) 中被提出"
#: ../../whatsnew/2.3.rst:806
msgid ""
"Written and implemented by Kevin Altis, Dave Cole, Andrew McNamara, Skip "
"Montanaro, Cliff Wells."
msgstr ""
"由 Kevin Altis, Dave Cole, Andrew McNamara, Skip Montanaro, Cliff Wells "
"撰写并实现。"
#: ../../whatsnew/2.3.rst:815
msgid "PEP 307: Pickle Enhancements"
msgstr "PEP 307:对 pickle 的改进"
#: ../../whatsnew/2.3.rst:817
msgid ""
"The :mod:`pickle` and :mod:`cPickle` modules received some attention during "
"the 2.3 development cycle. In 2.2, new-style classes could be pickled "
"without difficulty, but they weren't pickled very compactly; :pep:`307` "
"quotes a trivial example where a new-style class results in a pickled string"
" three times longer than that for a classic class."
msgstr ""
#: ../../whatsnew/2.3.rst:823
msgid ""
"The solution was to invent a new pickle protocol. The :func:`pickle.dumps` "
"function has supported a text-or-binary flag for a long time. In 2.3, this"
" flag is redefined from a Boolean to an integer: 0 is the old text-mode "
"pickle format, 1 is the old binary format, and now 2 is a new 2.3-specific "
"format. A new constant, :const:`pickle.HIGHEST_PROTOCOL`, can be used to "
"select the fanciest protocol available."
msgstr ""
"解决办法就是发明一种新的 pickle 协议。 :func:`pickle.dumps` 函数很早就支持文本或二进制标志。 在 2.3 "
"中,该标志从布尔值重新定义为整数:0 表示旧的文本模式 pickle 格式,1 表示旧的二进制格式,现在 2 表示新的 2.3 专用格式。 一个新常量 "
":const:`pickle.HIGHEST_PROTOCOL` 可用来选择最先进的协议。"
#: ../../whatsnew/2.3.rst:830
msgid ""
"Unpickling is no longer considered a safe operation. 2.2's :mod:`pickle` "
"provided hooks for trying to prevent unsafe classes from being unpickled "
"(specifically, a :attr:`__safe_for_unpickling__` attribute), but none of "
"this code was ever audited and therefore it's all been ripped out in 2.3. "
"You should not unpickle untrusted data in any version of Python."
msgstr ""
#: ../../whatsnew/2.3.rst:836
msgid ""
"To reduce the pickling overhead for new-style classes, a new interface for "
"customizing pickling was added using three special methods: "
":meth:`__getstate__`, :meth:`__setstate__`, and :meth:`__getnewargs__`. "
"Consult :pep:`307` for the full semantics of these methods."
msgstr ""
#: ../../whatsnew/2.3.rst:841
msgid ""
"As a way to compress pickles yet further, it's now possible to use integer "
"codes instead of long strings to identify pickled classes. The Python "
"Software Foundation will maintain a list of standardized codes; there's also"
" a range of codes for private use. Currently no codes have been specified."
msgstr ""
"为了进一步压缩 pickle 类,现在可以使用整数代码而不是长字符串来标识 pickle 类。 Python "
"软件基金会将维护一个标准化代码列表;还有一系列供私人使用的代码。 目前还没有指定任何代码。"
#: ../../whatsnew/2.3.rst:849
msgid ":pep:`307` - Extensions to the pickle protocol"
msgstr ":pep:`307` - pickle 协议的扩展"
#: ../../whatsnew/2.3.rst:850
msgid "Written and implemented by Guido van Rossum and Tim Peters."
msgstr "PEP 由 Guido van Rossum 和 Tim Peters 撰写和实现。"