Size: 7395
Comment:
|
Size: 7339
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
1. ''Para 1'':……Python 中'''任何东西都是对象''' <!> ,…… (!) 为了和前面章节的用词统一, (./) '''万物皆对象''' | 1. `Para 1`:……Python 中'''任何东西都是对象''' <!> ,…… (!) 为了和前面章节的用词统一, (./) '''万物皆对象''' |
Line 5: | Line 5: |
1. ''例4.2上'':……它可以'''使用''' <!> 任何……作为参数…… (./) '''接受''' 1. ''例4.2, Para 1'':缺省地,程序输出进行了格式化处理 {i} ^,以使其^易于阅读 |
1. `例4.2上`:……它可以'''使用''' <!> 任何……作为参数…… (./) '''接受''' 1. `例4.2, Para 1`:缺省地,程序输出进行了格式化处理 {i} ^,以使其^易于阅读 |
Line 8: | Line 8: |
1. ''例4.4下, 提示'':调用函数时唯一'''需要''' <!> 做的事情就是为每一个必备参数指定值…… (./) '''必须''' | 1. `例4.4下, 提示`:调用函数时唯一'''需要''' <!> 做的事情就是为每一个必备参数指定值…… (./) '''必须''' |
Line 10: | Line 10: |
1. ''Para 1'':''...This was actually a conscious design decision,...''[[BR]] | 1. `Para 1`:''...This was actually a conscious design decision,...''[[BR]] |
Line 14: | Line 14: |
1. ''Para 2'':添加了脚注:[[BR]] | 1. `Para 2`:添加了脚注:[[BR]] |
Line 20: | Line 20: |
1. ''Para 1'':''The str coerces data into a string. Every datatype can be coerced into a string.''[[BR]] | 1. `Para 1`:''The str coerces data into a string. Every datatype can be coerced into a string.''[[BR]] |
Line 24: | Line 24: |
1. ''例4.6, (4)'':''You'll use this to your advantage in the info function...''[[BR]] | 1. `例4.6, (4)`:''You'll use this to your advantage in the info function...''[[BR]] |
Line 27: | Line 27: |
1. ''例4.7, (1)'':li 是一个列表,所以 dir(li) 返回 {i} ^一个包含^所有列表方法的'''一个''' {X} 列表。 1. ''例4.8上'':如果参数对象是可调用的'''那么'''返回 true''','''否则返回 false。[[BR]] |
1. `例4.7, (1)`:li 是一个列表,所以 dir(li) 返回 {i} ^一个包含^所有列表方法的'''一个''' {X} 列表。 1. `例4.8上`:如果参数对象是可调用的'''那么'''返回 true''','''否则返回 false。[[BR]] |
Line 30: | Line 30: |
1. ''例4.8, (1)'':''...but the module contains a lot of useful constants like this string.punctuation, which contains all the standard punctuation characters.''[[BR]] | 1. `例4.8, (1)`:''...but the module contains a lot of useful constants like this string.punctuation, which contains all the standard punctuation characters.''[[BR]] |
Line 35: | Line 35: |
1. ''Para 2'':像这样考虑的好处是,'''是你'''可以获取__builtin__ 模块信息的…… (!) 估计是typo (./) '''你是''' 1. ''Para 2'':猜到什么了吗,^现在我们的 ^Python 有一个称为 info 的函数。 (!) 从上下文来看,info函数明显是作者自己写的,而不是Python原有的。 1. ''Para 2, Line -1'':……应该看上去已经^很^熟悉了。 (!) 这里是为了中文表达的顺畅 |
1. `Para 2`:像这样考虑的好处是,'''是你'''可以获取__builtin__ 模块信息的…… (!) 估计是typo (./) '''你是''' 1. `Para 2`:猜到什么了吗,^现在我们的 ^Python 有一个称为 info 的函数。 (!) 从上下文来看,info函数明显是作者自己写的,而不是Python原有的。 1. `Para 2, Line -1`:……应该看上去已经^很^熟悉了。 (!) 这里是为了中文表达的顺畅 |
Line 39: | Line 39: |
1. ''例4.10, (3)'':如果不'''深信'''它是多么的有用 (./) '''确信''' 1. ''例4.12, (3)'':现在你可以简单地调用输出函数就像调用其它函数一样'''了'''。[[BR]] |
1. `例4.10, (3)`:如果不'''深信'''它是多么的有用 (./) '''确信''' 1. `例4.12, (3)`:现在你可以简单地调用输出函数就像调用其它函数一样'''了'''。[[BR]] |
Line 43: | Line 43: |
1. ''Para 3'':''A filter expression can be any expression that evaluates true or false (which in Python can be almost anything)''[[BR]] | 1. `Para 3`:''A filter expression can be any expression that evaluates true or false (which in Python can be almost anything)''[[BR]] |
Line 47: | Line 47: |
1. ''同上'':任何经过滤器表达式演算值为'''元素的真'''都可以包含在映射中。[[BR]] | 1. `同上`:任何经过滤器表达式演算值为'''元素的真'''都可以包含在映射中。[[BR]] |
Line 49: | Line 49: |
1. ''进一步阅读上,整段'':'''部件''' <!> 一律改为更常见的术语, (./) '''成员'''。(不再列出全文,还请自己参看) 1. ''进一步阅读'':Python Tutorial 讨论了 使用内置'''过滤器''' <!> 函数……[[BR]] |
1. `进一步阅读上,整段`:'''部件''' <!> 一律改为更常见的术语, (./) '''成员'''。(不再列出全文,还请自己参看) 1. `进一步阅读`:Python Tutorial 讨论了 使用内置'''过滤器''' <!> 函数……[[BR]] |
Line 55: | Line 55: |
1. ''例4.18上'':'''不只''' <!> 一次 (./) '''不止''' 1. ''例4.18下'':and-or技巧, {i} ^也就是^bool and a or b表达式…… |
1. `例4.18上`:'''不只''' <!> 一次 (./) '''不止''' 1. `例4.18下`:and-or技巧, {i} ^也就是^bool and a or b表达式…… |
Line 58: | Line 58: |
1. ''例4.20, (2)'':'''你可以'''使用 lambda 函数甚至不需要将它赋值给一个变量。[[BR]] | 1. `例4.20, (2)`:'''你可以'''使用 lambda 函数甚至不需要将它赋值给一个变量。[[BR]] |
Line 60: | Line 60: |
1. ''例4.21, (2)'':''split without any arguments splits on whitespace.''[[BR]] | 1. `例4.21, (2)`:''split without any arguments splits on whitespace.''[[BR]] |
Line 63: | Line 63: |
1. ''Para 2'':''This is the meat of apihelper.py:''[[BR]] | 1. `Para 2`:''This is the meat of apihelper.py:''[[BR]] |
Line 65: | Line 65: |
1. ''Para 4'':[[BR]] | 1. `Para 4`:[[BR]] |
Line 72: | Line 72: |
1. ''例4.23, (1)'':''Confusingly, if you evaluate the `__doc__` attribute directly, the Python IDE prints nothing at all, which makes sense if you think about it, but is still unhelpful.''[[BR]] | 1. `例4.23, (1)`:''Confusingly, if you evaluate the `__doc__` attribute directly, the Python IDE prints nothing at all, which makes sense if you think about it, but is still unhelpful.''[[BR]] |
Line 76: | Line 76: |
1. ''例4.25, (1)'':''This is also a useful debugging trick when you're working with lists. And in Python, you're always working with lists.''[[BR]] | 1. `例4.25, (1)`:''This is also a useful debugging trick when you're working with lists. And in Python, you're always working with lists.''[[BR]] |
7-1<X4> apihelper.xml 自省的威力
Para 1:……Python 中任何东西都是对象
,……
为了和前面章节的用词统一,
万物皆对象
概览
例4.2上:……它可以使用
任何……作为参数……
接受
例4.2, Para 1:缺省地,程序输出进行了格式化处理
,以使其易于阅读
使用可选参数和命名参数
例4.4下, 提示:调用函数时唯一需要
做的事情就是为每一个必备参数指定值……
必须
使用 type、str、dir 和其它内置函数
Para 1:...This was actually a conscious design decision,...BR ……其实这是一个非常明智的设计决策……BR
decision固然是“决策”的意思,但我想此处Mark的意思应该是“策略”而不是“决策”。BR
……其实这是一个非常明智的设计策略……
Para 2:添加了脚注:BR 这对于处理多种数据类型的帮助者函数 <footnote><para>帮助者函数,原文是 helper function,也就是我们在前文所看到的诸如 <literal>odbchelper</literal>、<literal>apihelper</literal> 这样的函数。——译注</para></footnote> 非常有用。BR
helper function这个术语的出现对于英文阅读者十分自然(helper已经出现在函数名中了),但中文版应该予以说明。
type 函数
pass
str 函数
Para 1:The str coerces data into a string. Every datatype can be coerced into a string.BR str 将数据强制转型
为字符串。每种数据类型都可以强制转型为字符串。BR
coerce在国内不是通译为“强制转换”吗,我真不知道[:YuLin]是怎么会想到用“转型”这个词的。(台湾译风的影响?)BR
转换BR
例4.6, (4):You'll use this to your advantage in the info function...BR 你将会使用这一点来提高你的 info 函数BR
你将会使用这一点来改进你的 info 函数
例4.7, (1):li 是一个列表,所以 dir(li) 返回
一个包含所有列表方法的一个
列表。
例4.8上:如果参数对象是可调用的那么返回 true,否则返回 false。BR
如果参数对象是可调用的,返回 true;否则返回 false。
例4.8, (1):...but the module contains a lot of useful constants like this string.punctuation, which contains all the standard punctuation characters.BR 但是在这个模块中包含了许多有用的变量比如 string.punctuation,这个模块包含了所有标准的标点符号字符。BR
估计是一个which把译者给搞懵了,竟然稀里糊涂地翻译成了“模块”BR
但是在这个模块中包含了许多有用的变量,例如 string.punctuation,这个字符串包含了所有标准的标点符号字符。
内置函数
Para 2:像这样考虑的好处是,是你可以获取builtin 模块信息的……
估计是typo
你是
Para 2:猜到什么了吗,现在我们的 Python 有一个称为 info 的函数。
从上下文来看,info函数明显是作者自己写的,而不是Python原有的。
Para 2, Line -1:……应该看上去已经很熟悉了。
这里是为了中文表达的顺畅
通过getattr获取对象引用
例4.10, (3):如果不深信它是多么的有用
确信
例4.12, (3):现在你可以简单地调用输出函数就像调用其它函数一样了。BR
现在你可以简单地调用输出函数,就像调用其它函数一样。
过滤列表
Para 3:A filter expression can be any expression that evaluates true or false (which in Python can be almost anything)BR 过滤器表达式可以是返回值为真或者假(在 Python 中是 几乎任何东西)的任何表达式。BR
又一次没有把握语序,括号里面的内容解说的是expression而非false。况且大多数 Python 表达式的值是真,而不是假。BR
过滤器表达式可以是返回值为真或者假的任何表达式(在 Python 中是 几乎任何东西)。
同上:任何经过滤器表达式演算值为元素的真都可以包含在映射中。BR
任何经过滤器表达式演算值为真的元素都可以包含在映射中。
进一步阅读上,整段:部件
一律改为更常见的术语,
成员。(不再列出全文,还请自己参看)
进一步阅读:Python Tutorial 讨论了 使用内置过滤器
函数……BR
过度翻译,Python里可没有叫做“过滤器”的函数,只有filter函数BR
filter
and 和 or 的特殊性质
为了和前面章节的用词一致,布尔上下文
一律改为前文中使用的,也是更好的术语,
布尔环境。
例4.18上:不只
一次
不止
例4.18下:and-or技巧,
也就是bool and a or b表达式……
使用 lambda 函数
例4.20, (2):你可以使用 lambda 函数甚至不需要将它赋值给一个变量。BR
使用 lambda 函数时甚至不需要将它赋值给一个变量。
例4.21, (2):split without any arguments splits on whitespace.BR 不带参数的 split 按照空格
进行分割。
翻译错误
空白
全部放在一起
Para 2:This is the meat of apihelper.py:BR 下面是 apihelper.py 的根本
:
关键
Para 4:BR Now, let's take it from the end and work backwards. TheBR for method in methodListBR 现在,让我们从后向前分析。这个BR for method in methodListBR ……BR
从下文看来,这里的“这个”画蛇添足,宁肯去掉。况且“the”翻译为“这个”也不甚妥当。
例4.23, (1):Confusingly, if you evaluate the __doc__ attribute directly, the Python IDE prints nothing at all, which makes sense if you think about it, but is still unhelpful.BR 令人迷惑的是,如果你直接演算 __doc__ 属性的值,Python IDE 什么都不会打印,如果你只是考虑它,是有意义的,但是却没有什么用。BR
翻译有些生硬。if you think about it不译也不会对句子的意思产生多大影响,宁肯不译。BR
这是有意义的,但是却没有什么用。
例4.25, (1):This is also a useful debugging trick when you're working with lists. And in Python, you're always working with lists.BR 在你处理列表时,这确实是一个有用的调试技巧。还有一点在 Python 中,你总是在操纵列表。BR
此处翻译不太灵活,让人费解。BR
在 Python 中,你会十分频繁地操作列表。