Python in Practice

Errata

ISBN-10: 0321905636 – ISBN-13: 978-0321905635

Dr Dobbs JOLT best book award winner

Issue Resolution Reporter
Page 36. Possible Error A code snippet on this page refers to the Qtrac.Requirer class which isn't shown in the book but is included in the source in the file Qtrac.py. According to the reporter the __subclasshook__() method is incorrect. Here's the reporter's version:
@classmethod
def __subclasshook__(Class, Subclass):
    methods = set()
    for Superclass in Class.__mro__:
	if hasattr(Superclass, "required_methods"):
	    methods |= set(Superclass.required_methods)
    if not methods:
	return NotImplemented
    attributes = collections.ChainMap(*(Superclass.__dict__
	    for Superclass in Subclass.__mro__))
    if all(method in attributes for method in methods):
	return True
    return NotImplemented
Paolo Pastori
Page 111. Possible Error The reporter claims that the def update method on this page uses an incorrect expression to set tippingPoint. The reporter says the code should be:
tippingPoint = round((model.value - model.minimum) * self.length /
                     (model.maximum - model.minimum))
Paolo Pastori
Page 174. Error In the paragraph beginning “After each future...” delete the phrase “returns immediately and” from the second sentence. (If you want an immediate return pass wait=False.) Hyunsok Oh

Top