The errata list is a list of errors and their corrections that were found after the product was released.
The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.
Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update
Version |
Location |
Description |
Submitted by |
Date submitted |
PDF, O'Reilly learning platform |
Page Chapter 1: Introduction to Robust Python, page 16
Recursion code snippet |
"""
Recursion
Recursion is used when the substructure of a collection is identical to the structure of a collection (for example, each child of a tree is also a tree).
def list_ingredients(item):
if isinstance(item, PreparedIngredient):
list_ingredients(item)
else:
print(ingredient)
"""
It is infinite recursion, there should be some kind of item modification + "item" should be a list or other container, with name "items" or similar + "ingredient" is not defined there
|
Łukasz Janiec |
Feb 06, 2024 |
PDF |
Page 139
Integer conversion: code samples |
class ImperialLiquidMeasure(Enum):
CUP = 8
PINT = 16
QUART = 32
GALLON = 128
That is outright misleadingly WRONG.
If I saw that class in use in other code and I saw 20 fl.oz. being converted to (or from) 1 pint 4 fl.oz., I'd be reporting that as a bug – I'd expect either 20 fl.oz. to 1 pint or 1 pt 4 fl.oz. to 24 fl.oz.
So either the class name should be AmericanLiquidMeasure (or something similar) or the enumeration should be replaced as follows, with subsequent examples adjusted accordingly:
class ImperialLiquidMeasure(Enum):
PINT = 20
QUART = 40
GALLON = 160
(You'll have noticed that there's no ‘CUP’. That's not an Imperial measurement unit.)
|
D Salt |
Jul 02, 2023 |
PDF |
Page 264
code snippet |
instead of:
for observer_func in observers:
observer(order)
there should be
for observer_func in observers:
observer_func(order)
|
Ivan |
May 10, 2023 |