@@ -10,7 +10,7 @@ msgstr ""
1010"Report-Msgid-Bugs-To : \n "
1111"POT-Creation-Date : 2018-07-26 08:41+0900\n "
1212"PO-Revision-Date : YEAR-MO-DA HO:MI+ZONE\n "
13- "Last-Translator : Shengjing Zhu <zsj950618 @gmail.com>, 2018\n "
13+ "Last-Translator : ww song <sww4718168 @gmail.com>, 2018\n "
1414"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
1515"MIME-Version : 1.0\n "
1616"Content-Type : text/plain; charset=UTF-8\n "
@@ -64,6 +64,11 @@ msgid ""
6464"(arithmetic operators, subscripting etc.) can be redefined for class "
6565"instances."
6666msgstr ""
67+ "在C++术语中,通常类成员(包括数据成员)是*public*(除了见下文 :ref:`tut-private` ),所有成员函数都是*virtual"
68+ "*。与在Modula-"
69+ "3中一样,没有用于从其方法引用对象成员的简写:方法函数使用表示对象的显式第一个参数声明,该参数由调用隐式提供。与Smalltalk一样,类本身也是对象。这为导入和重命名提供了语义。与C"
70+ "++和Modula-"
71+ "3不同,内置类型可以用作用户扩展的基类。此外,与C++一样,大多数具有特殊语法(算术运算符,下标等)的内置运算符都可以重新定义为类实例。"
6772
6873#: ../../tutorial/classes.rst:34
6974msgid ""
@@ -72,6 +77,8 @@ msgid ""
7277"since its object-oriented semantics are closer to those of Python than C++, "
7378"but I expect that few readers have heard of it.)"
7479msgstr ""
80+ " (由于缺乏普遍接受的术语来讨论类,我偶尔会使用Smalltalk和C ++术语。我会使用Modula-3术语,因为它的面向对象语义比C "
81+ "++更接近Python,但我r认为读者很少听说过。)"
7582
7683#: ../../tutorial/classes.rst:43
7784msgid "A Word About Names and Objects"
@@ -92,6 +99,8 @@ msgid ""
9299"the caller will see the change --- this eliminates the need for two "
93100"different argument passing mechanisms as in Pascal."
94101msgstr ""
102+ "对象具有个性,多个名称(在多个范围内)可以绑定到同一个对象。这在其他语言中称为别名。乍一看Python时通常不会理解这一点,在处理不可变的基本类型(数字,字符串,元组)时可以安全地忽略它。但是,别名对涉及可变对象,如,列表,字典和大多数其他类型,的Python代码的语义可能会产生惊人的影响。这通常用于程序的好处,因为别名在某些方面表现得像指针。例如,传递一个对象很便宜,因为实现只传递一个指针;如果函数修改了作为参数传递的对象,调用者将看到更改"
103+ "---这消除了对Pascal中两个不同的参数传递机制的需要。"
95104
96105#: ../../tutorial/classes.rst:61
97106msgid "Python Scopes and Namespaces"
@@ -105,10 +114,11 @@ msgid ""
105114"understand what's going on. Incidentally, knowledge about this subject is "
106115"useful for any advanced Python programmer."
107116msgstr ""
117+ "在介绍类之前,我首先要告诉你一些Python的作用域规则。类定义对命名空间有一些巧妙的技巧,你需要知道作用域和命名空间如何工作才能完全理解正在发生的事情。顺便说一下,关于这个主题的知识对任何高级Python程序员都很有用。"
108118
109119#: ../../tutorial/classes.rst:69
110120msgid "Let's begin with some definitions."
111- msgstr ""
121+ msgstr "让我们从一些定义开始。 "
112122
113123#: ../../tutorial/classes.rst:71
114124msgid ""
@@ -181,27 +191,27 @@ msgid ""
181191"Although scopes are determined statically, they are used dynamically. At any"
182192" time during execution, there are at least three nested scopes whose "
183193"namespaces are directly accessible:"
184- msgstr ""
194+ msgstr " 尽管范围是静态确定的,但它们是动态使用的。在执行期间的任何时候,至少有三个嵌套的作用域,其名称空间可以直接访问: "
185195
186196#: ../../tutorial/classes.rst:120
187197msgid "the innermost scope, which is searched first, contains the local names"
188- msgstr ""
198+ msgstr "最先搜索的最内部作用域包含局部名称 "
189199
190200#: ../../tutorial/classes.rst:121
191201msgid ""
192202"the scopes of any enclosing functions, which are searched starting with the "
193203"nearest enclosing scope, contains non-local, but also non-global names"
194- msgstr ""
204+ msgstr "从最近的封闭作用域开始搜索的任何封闭函数的范围包含非局部名称,也包括非全局名称 "
195205
196206#: ../../tutorial/classes.rst:123
197207msgid "the next-to-last scope contains the current module's global names"
198- msgstr ""
208+ msgstr "倒数第二个作用域包含当前模块的全局名称 "
199209
200210#: ../../tutorial/classes.rst:124
201211msgid ""
202212"the outermost scope (searched last) is the namespace containing built-in "
203213"names"
204- msgstr ""
214+ msgstr "最外面的范围(最后搜索)是包含内置名称的命名空间 "
205215
206216#: ../../tutorial/classes.rst:126
207217msgid ""
@@ -263,10 +273,12 @@ msgid ""
263273"namespaces, and how :keyword:`global` and :keyword:`nonlocal` affect "
264274"variable binding::"
265275msgstr ""
276+ " 这是一个演示如何引用不同作用域和名称空间的示例,以及如何 :keyword:`global` 和 :keyword:`nonlocal` "
277+ "影响变量绑定::"
266278
267279#: ../../tutorial/classes.rst:191
268280msgid "The output of the example code is:"
269- msgstr ""
281+ msgstr "示例代码的输出是: "
270282
271283#: ../../tutorial/classes.rst:200
272284msgid ""
@@ -280,7 +292,7 @@ msgstr ""
280292msgid ""
281293"You can also see that there was no previous binding for *spam* before the "
282294":keyword:`global` assignment."
283- msgstr ""
295+ msgstr "您还可以在 :keyword:`global` 赋值之前看到之前没有 *spam* 的绑定。 "
284296
285297#: ../../tutorial/classes.rst:212
286298msgid "A First Look at Classes"
@@ -290,15 +302,15 @@ msgstr "初探类"
290302msgid ""
291303"Classes introduce a little bit of new syntax, three new object types, and "
292304"some new semantics."
293- msgstr ""
305+ msgstr "类引入了一些新语法,三种新对象类型和一些新语义。 "
294306
295307#: ../../tutorial/classes.rst:221
296308msgid "Class Definition Syntax"
297309msgstr "类定义语法"
298310
299311#: ../../tutorial/classes.rst:223
300312msgid "The simplest form of class definition looks like this::"
301- msgstr ""
313+ msgstr "最简单的类定义看起来像这样:: "
302314
303315#: ../../tutorial/classes.rst:232
304316msgid ""
@@ -344,7 +356,7 @@ msgstr "类对象"
344356msgid ""
345357"Class objects support two kinds of operations: attribute references and "
346358"instantiation."
347- msgstr ""
359+ msgstr "类对象支持两种操作:属性引用和实例化。 "
348360
349361#: ../../tutorial/classes.rst:264
350362msgid ""
@@ -374,7 +386,7 @@ msgstr ""
374386msgid ""
375387"creates a new *instance* of the class and assigns this object to the local "
376388"variable ``x``."
377- msgstr ""
389+ msgstr "创建类的新*实例*并将此对象分配给局部变量 ``x``。 "
378390
379391#: ../../tutorial/classes.rst:291
380392msgid ""
@@ -407,7 +419,7 @@ msgid ""
407419"Now what can we do with instance objects? The only operations understood by"
408420" instance objects are attribute references. There are two kinds of valid "
409421"attribute names, data attributes and methods."
410- msgstr ""
422+ msgstr "现在我们可以用实例对象做什么?实例对象理解的唯一操作是属性引用。有两种有效的属性名称,数据属性和方法。 "
411423
412424#: ../../tutorial/classes.rst:328
413425msgid ""
@@ -446,7 +458,7 @@ msgstr "方法对象"
446458
447459#: ../../tutorial/classes.rst:362
448460msgid "Usually, a method is called right after it is bound::"
449- msgstr ""
461+ msgstr "通常,方法在绑定后立即调用:: "
450462
451463#: ../../tutorial/classes.rst:366
452464msgid ""
@@ -458,7 +470,7 @@ msgstr ""
458470
459471#: ../../tutorial/classes.rst:374
460472msgid "will continue to print ``hello world`` until the end of time."
461- msgstr ""
473+ msgstr "将继续打印 ``hello world`` ,直到时间结束。 "
462474
463475#: ../../tutorial/classes.rst:376
464476msgid ""
@@ -503,7 +515,7 @@ msgid ""
503515"Generally speaking, instance variables are for data unique to each instance "
504516"and class variables are for attributes and methods shared by all instances "
505517"of the class::"
506- msgstr ""
518+ msgstr "一般来说,实例变量用于每个实例的唯一数据,而类变量用于类的所有实例共享的属性和方法:: "
507519
508520#: ../../tutorial/classes.rst:427
509521msgid ""
@@ -516,7 +528,7 @@ msgstr ""
516528
517529#: ../../tutorial/classes.rst:450
518530msgid "Correct design of the class should use an instance variable instead::"
519- msgstr ""
531+ msgstr "正确的类设计应该使用实例变量:: "
520532
521533#: ../../tutorial/classes.rst:474
522534msgid "Random Remarks"
@@ -591,7 +603,7 @@ msgstr ""
591603msgid ""
592604"Methods may call other methods by using method attributes of the ``self`` "
593605"argument::"
594- msgstr ""
606+ msgstr "方法可以通过使用``self``参数的方法属性调用其他方法:: "
595607
596608#: ../../tutorial/classes.rst:546
597609msgid ""
@@ -610,7 +622,7 @@ msgstr ""
610622msgid ""
611623"Each value is an object, and therefore has a *class* (also called its "
612624"*type*). It is stored as ``object.__class__``."
613- msgstr ""
625+ msgstr "每个值都是一个对象,因此具有 *class*(也称为*type*)。它存储为 ``object .__ class__``。 "
614626
615627#: ../../tutorial/classes.rst:563
616628msgid "Inheritance"
@@ -621,7 +633,7 @@ msgid ""
621633"Of course, a language feature would not be worthy of the name \" class\" "
622634"without supporting inheritance. The syntax for a derived class definition "
623635"looks like this::"
624- msgstr ""
636+ msgstr "当然,如果不支持继承,语言特性就不值得称为“类”。派生类定义的语法如下所示:: "
625637
626638#: ../../tutorial/classes.rst:576
627639msgid ""
@@ -671,7 +683,7 @@ msgstr ""
671683
672684#: ../../tutorial/classes.rst:608
673685msgid "Python has two built-in functions that work with inheritance:"
674- msgstr ""
686+ msgstr "Python有两个内置函数同继承一起工作: "
675687
676688#: ../../tutorial/classes.rst:610
677689msgid ""
@@ -696,7 +708,7 @@ msgstr "多重继承"
696708msgid ""
697709"Python supports a form of multiple inheritance as well. A class definition "
698710"with multiple base classes looks like this::"
699- msgstr ""
711+ msgstr " Python也支持多重继承的形式。具有多个基类的类定义如下所示:: "
700712
701713#: ../../tutorial/classes.rst:636
702714msgid ""
@@ -765,14 +777,14 @@ msgstr ""
765777msgid ""
766778"Name mangling is helpful for letting subclasses override methods without "
767779"breaking intraclass method calls. For example::"
768- msgstr ""
780+ msgstr "名称修改有助于让子类重载方法而不破坏类内方法调用。例如:: "
769781
770782#: ../../tutorial/classes.rst:706
771783msgid ""
772784"Note that the mangling rules are designed mostly to avoid accidents; it "
773785"still is possible to access or modify a variable that is considered private."
774786" This can even be useful in special circumstances, such as in the debugger."
775- msgstr ""
787+ msgstr "请注意,修剪规则主要是为了避免事故;它仍然可以访问或修改被视为私有的变量。这在特殊情况下甚至可能很有用,例如在调试器中。 "
776788
777789#: ../../tutorial/classes.rst:710
778790msgid ""
@@ -794,6 +806,7 @@ msgid ""
794806"or C \" struct\" , bundling together a few named data items. An empty class "
795807"definition will do nicely::"
796808msgstr ""
809+ "有时,使用类似于Pascal “record”或C “struct”的数据类型是有用的,将一些命名数据项捆绑在一起。定义一个空类就很适合::"
797810
798811#: ../../tutorial/classes.rst:737
799812msgid ""
@@ -820,7 +833,7 @@ msgstr "迭代器"
820833msgid ""
821834"By now you have probably noticed that most container objects can be looped "
822835"over using a :keyword:`for` statement::"
823- msgstr ""
836+ msgstr "到目前为止,您可能已经注意到大多数容器对象都可以使用 :keyword:`for` 语句:: "
824837
825838#: ../../tutorial/classes.rst:772
826839msgid ""
0 commit comments