Skip to content

Instantly share code, notes, and snippets.

@SaveTheRbtz
Last active October 3, 2015 20:28
Show Gist options
  • Save SaveTheRbtz/2521717 to your computer and use it in GitHub Desktop.
Save SaveTheRbtz/2521717 to your computer and use it in GitHub Desktop.
My tiny errata for Python Essential Reference

Errata for Python Essential Reference

Fourth Edition (by David M. Beazley)

Chapter 9

p. 170

I'm myself by no means UTF-8 guru but there is some inconsistency with RFC3629: Last two bytes are 7bit long:

- 11110nnn 10nnnnnn 10nmmmm 10mmmmmm
+ 11110www 10xxxxxx 10yyyyyy 10zzzzzzz
3 + 6 + 6 + 6 = 21 bits which maps to::
00000000 000wwwxx xxxxyyyy yyzzzzzz

Chapter 15

p. 271

count() does not overflow (at least in Python 2.6+).

Chapter 21

p. 450 - p. 451

Should shutdown/close be added to Figures? Also I suppose TCP client may preform bind() and UDP client can use connect() + send()

Chapter 24

p. 560

!= and == based comparisons in python have very nasty time side channel and should never ever used in crypto:

$ python -m timeit -c '"0"*16 != "1"*16'
10000000 loops, best of 3: 0.153 usec per loop
$ python -m timeit -c '"1"*16 != "1"*16'
10000000 loops, best of 3: 0.145 usec per loop

Chapter 26

p. 593

To run file in current directory you should use::
  • a.out
  • ./a.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment