#pragma section-numbers off
= 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`''':<
>
<
>
''Here is the basic from module import syntax:<
>
`from UserDict import UserDict`<
>
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.''<
>
= 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.''<
>
(!) 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.
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. Here is a picture showing the conflictings. I adopted the result in `stage 2` for `2c`.<
>
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.
{{attachment:stage0.jpg}}