Differences between revisions 1 and 2
Revision 1 as of 2007-08-24 11:23:27
Size: 2557
Editor: XiaoQi
Comment:
Revision 2 as of 2007-08-24 11:40:34
Size: 2468
Editor: XiaoQi
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
[[Include(../xbar)]]
以下是 Dip 原版的勘误。勘误表中指出的错误在 4.5b 版中均已修正。
= 5. 对象和面向对象 =
== 5.2 使用 from module import 导入模块 ==
 `Para 2`:注意粗体部分。代码中显示的被导入的对象是 '''UserDict 类''',而不是 '''types 模块的属性和方法'''。[[BR]]

= Errata for Dive Into Python 5.4 =
= 5. Objects and Object-Orientation =
== 5.2 Importing Modules Using from module import ==
 `Para 2`: Notice the words in bold. The code shows the imported object is '''class UserDict''', not '''the attributes and methods of the imported module `types`'''.[[BR]]
Line 10: Line 10:
 下面是 from module import 的基本语法:[[BR]]
 `from UserDict import UserDict`[[BR]]
 它与你所熟知的 import module 语法很相似,但是有一个重要的区别:'''被导入模块 types 的属性和方法被直接导入到局部名字空间去了,所以它们可以直接使用''',而不需要加上模块名的限定。[[BR]]
 (./) UserDict 被直接导入到局部名字空间去了,所以它可以直接使用,而不需要加上模块名的限定。
= 7. 正则表达式 =
== 7.4 使用 {n,m} 语法 ==
 其实本节的问题 Zoomq 在翻译的时候就已经指出了,只是出于忠实原文的考虑,没有改动。罗马数字语法矛盾的问题通过简单修改代码即可完美解决。
Line 18: Line 11:
= 12. SOAP Web 服务 =
== 12.6 以 WSDL 进行 SOAP 内省 ==
 `例 12.8`:注意第二行多了一个右括号。
= 7. Regular Expressions =
== 7.4 Using the {n,m} Syntax ==
 `Example 7.7`: The rule that `M` cannot repeat for more than three times is broken. Relative bugs are found in this section and the following section.

= 12. SOAP Web Services =
== 12.6 Introspecting SOAP Web Services with WSDL ==
 `Example 12.8`: Notice that there is one more `)` on the second line.
Line 29: Line 26:
= 16. 函数编程 =
== 16.3 重识列表过滤 ==
 `例16.7, (1)`:''odd uses the built-in mod function "%" to return `True` if n is odd and `False` if n is even.''[[BR]]
 odd 使用内建的取模(mod)函数 "%" 对于为奇数的 n 返回 `True`;为偶数的返回 `False`。[[BR]]
 (./) odd 使用内建的取模(mod)函数 "%" 对于为奇数的 n 返回 1;为偶数的返回 0。[[BR]]
 (!) 1 和 0 被 typo 为 True 和 False 是有原因的,你可以在修订历史里面找到。Mark 在 Dip 的早期版本中(那时 Python 还没有独立的 bool 类型)把 True, False 与 1, 0 都混用了,后来可能是用了盲目替换,自己都被弄懵了。
= 16. Functional Programming =
== 16.3 Filtering lists revisited ==
 `Example 16.7, (1)`: ''odd uses the built-in mod function "%" to return `True` if n is odd and `False` if n is even.''[[BR]]
 (!) The `True` and `False` should be `1` and `0`.
Line 36: Line 31:
= 18. 性能优化 =
[[Include(/soundexbug)]]
= 18. Performance Tuning =
== A great bug ==
 1. The "best result so far" in `stage2` is `1e`, but the text said it is `1c`. The code is all right.
 1. The test result for `2c` differs too much in `stage 2` and in `stage 3`; either of them is wrong or should be abandoned.
 1. There are many conflictings between the text and the test result. Please refer to [../xe/soundexbug], there is a picture `stage0.jpg` showing the conflictings. I adopted the result in `stage 2` for `2c`.[[BR]]
 The black arrow shows the relationship according the text ("`a -> b`" means "`a is slower than b`"). The blue and red arrows show the conflictings. The numbers beside them stands for the test cases(`1. Woo, 2. Pilgrim, 3. Flingjingwaller`). Blue arrows mean that the two data differ little, so the conflicting may be ommited; and red arrows mean that the performance relationship between the two programs are totally on the opposite.

Errata for Dive Into Python 5.4

5. Objects and Object-Orientation

5.2 Importing Modules Using from module import

  • Para 2: Notice the words in bold. The code shows the imported object is class UserDict, not the attributes and methods of the imported module types.BR Here is the basic from module import syntax:BR from UserDict import UserDictBR This is similar to the import module syntax that you know and love, but with an important difference: the attributes and methods of the imported module types are imported directly into the local namespace, so they are available directly, without qualification by module name.BR

7. Regular Expressions

7.4 Using the {n,m} Syntax

  • Example 7.7: The rule that M cannot repeat for more than three times is broken. Relative bugs are found in this section and the following section.

12. SOAP Web Services

12.6 Introspecting SOAP Web Services with WSDL

  • Example 12.8: Notice that there is one more ) on the second line.

>>> from SOAPpy import WSDL
>>> wsdlFile = 'http://www.xmethods.net/sd/2001/TemperatureService.wsdl')
>>> server = WSDL.Proxy(wsdlFile)
>>> server.methods.keys()
[u'getTemp']

16. Functional Programming

16.3 Filtering lists revisited

  • Example 16.7, (1): odd uses the built-in mod function "%" to return True if n is odd and False if n is even.BR (!) The True and False should be 1 and 0.

18. Performance Tuning

A great bug

  1. The "best result so far" in stage2 is 1e, but the text said it is 1c. The code is all right.

  2. The test result for 2c differs too much in stage 2 and in stage 3; either of them is wrong or should be abandoned.

  3. There are many conflictings between the text and the test result. Please refer to [../xe/soundexbug], there is a picture stage0.jpg showing the conflictings. I adopted the result in stage 2 for 2c.BR The black arrow shows the relationship according the text ("a -> b" means "a is slower than b"). The blue and red arrows show the conflictings. The numbers beside them stands for the test cases(1. Woo, 2. Pilgrim, 3. Flingjingwaller). Blue arrows mean that the two data differ little, so the conflicting may be ommited; and red arrows mean that the performance relationship between the two programs are totally on the opposite.

DiveIntoPythonZh/xe_en (last edited 2009-12-25 07:08:52 by localhost)