Errata

High Performance Python

Errata for High Performance Python

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
paragraph after example 8-2

after example 8-2 , there is an unnumbered example using "futures"
@coroutine
def save_value(value, callback):
print "Saving {} to database".format(value)
db_response = yield save_result_to_db(result, callback) # 1
print "Response from database: {}".format(db_response)

if __name__ == "__main__":
eventloop.put(
partial(save_value, "Hello World")
)

There is a mismatch between the save_value definition and use, as in the definition it requires a callback parameter, but in the use it isn't supplied. As previous example used callbacks, I think the callback is left over from there.

Note from the Author or Editor:
Fixed in 2nd ed

Nethanel Elzas  Jul 27, 2015 

All of the minus signs in the calculus formulas are plus signs. The second formula should read:

du(x,t)/dt = (u(x,t+dt) - u(x,t))/dt

The third should read:

u(x,t+dt) = u(x,t) + dt * D * (u(x+dx,t) + u(x-dx,t) - 2*u(x,t))/dx^2

Note from the Author or Editor:
Fixed in 2nd ed.

Anonymous  Aug 06, 2015 
ePub
Memory Fragmentation

def norm_squared_generator_comprehension(vector):
"""
>>> vector = range(1000000)
>>> %timeit norm_square_generator_comprehension(vector_list)
1000 loops, best of 3: 747 μs per loop
"""
return sum(v*v for v in vector)


the line inside the comment that starts with %timeit is incorrect. It should be

%timeit norm_squared_generator_comprehension(vector)

Note from the Author or Editor:
fixed in 2nd ed.

Ahmed Sharif  May 22, 2016 
I
chapter 1

"unit" -> "units"

"Typically this works well when the units of work across both threads use different types of execution unit[s]"

Zachary Kneupper  Jan 06, 2020 
Printed
Page 32
2nd paragraph

"julia1_cprofile.py" should probably be "julia1_nopil.py". Otherwise, there is no other reference to "julia1_cprofile.py" in the rest of the book

Note from the Author or Editor:
Fixed in 2nd ed

Sean Law  Jul 18, 2015 
Printed
Page 36
pip install runsnake

pip install runsnakerun

correct software name

Note from the Author or Editor:
Fixed

colin dick  Jun 10, 2015 
PDF
Page 73
last paragraph

I may be misguided by my mind but...


The mentioned lookup times seem strange to me.

Searching on unsorted list is O(n) - I find the mentioned "O(log n) at best" in the first sentence a bit confusing.

Searching on sorted list O(log n) - maybe this was the intended meaning of the sentence?

Searching on dictionaries/set is O(1) in most situations, O(n) in the worst case. - the sentence just mentions O(n).


I hope my comment may be of some value.
Thanks for a great book,
Jan

Note from the Author or Editor:
Fixed in 2nd ed

Jan Pipek  Aug 31, 2014 
Printed, PDF, ePub
Page 73
last paragraph

In the sentence
'dictionaries and sets give us O(n) lookups based on the arbitrary index'

O(n) should obviously be O(1)

Note from the Author or Editor:
Unfortunate typo, fixed in 2nd edition

Lauran  Jul 23, 2015 
PDF
Page 76
last several paragraph

I'm pretty sure that the time complexity analysis about list_unique_names() on the previous page (Page 75) is wrong. It's not O(nlogn) but O(n^2). And that's why the set algorithm give a drastic 267x speedup - because it's O(n^2) vs O(n), not O(nlogn) vs O(n).

By the way, in this whole chapter, I think some discussion about the complexity of searching sorted/unsorted list is vague and confusing, just like what Jan Pipek said before.

Note from the Author or Editor:
Fixed in 2nd edition.

Liang He  Dec 20, 2014 
PDF
Page 101
equation

The derivative was approximated to a sum instead of a subtraction.

Note from the Author or Editor:
Fixed in 2nd ed.

Bruno  Nov 02, 2017 
Printed
Page 102
1

the upper part of the fraction is u(x+dx,t) + u(x+dx,t) + 2.u(x,t) where it should be u(x+dx,t)+u(x-dx,t)+2.u(x,t) ? The 2nd term should be u(x-dx,t) (note the sign - instead of +) ?
Regards,
Louis

Note from the Author or Editor:
Fixed in 2nd edition

Louis Storme  Oct 14, 2014 
Printed
Page 104
Pseudocode for example 6-2

On the fourth line: u[j][(j-1)%M] should be u[i][(j-1)%M]

Note from the Author or Editor:
Fixed in 2nd Edition!

James Scott  May 17, 2019 
Printed
Page 143
3rd paragraph

"opimize" --> "optimize"

Note from the Author or Editor:
Fixed

Patrick  Jul 10, 2017 
PDF
Page 211
Example 9-2

In the Example 9-2 in the book, the pool uses calculate_pi:
nbr_in_unit_circles = pool.map(calculate_pi, nbr_trials_per_process)

However, the name of the def in Example 9-1 is estimate_nbr_points_in_quarter_circle.

So the code should be:
nbr_in_unit_circles = pool.map(estimate_nbr_points_in_quarter_circle, nbr_trials_per_process)

Note from the Author or Editor:
Will fix for 2nd ed

Sajjad  Sep 16, 2019 
Printed
Page 211
Example 9-2

In example 9-2, the pool.map calls a function "calculate_pi". But in example 9-1 it's called estimate_nbr_points_in_quarter_circle.

Note from the Author or Editor:
Will fix for 2nd ed

William Smith  Oct 19, 2019 
Printed
Page 251
Last paragraph

The text says "example 9-28 shows the important steps taken to share this array". But the code to do that is in example 9-30.

Note from the Author or Editor:
Thank you! Fixed for the 2nd edition.

William Smith  Oct 19, 2019 
Printed
Page 253
2nd paragraph

--Syou'll see that at the top ...
should be changed to:
-- you'll see that at the top ...

Note from the Author or Editor:
Fixed for 2nd ed

Sajjad  Sep 24, 2019 
Printed
Page 321
1st non-code paragraph

"Also, there are some imperially derived constants..."

should be

"Also, there are some empirically derived constants"

Note from the Author or Editor:
Fixed in the 2nd ed.

Kjell Swedin  Jun 01, 2015