O'Reilly logo
  • You Wang thinks this is interesting:

This file works identically in Python 2.X and 3.X. When run directly, it tests itself as before, but it uses options on the command line to control the test behavior. Run this file directly with no command-line arguments on your own to see what its self-test code prints—it’s too extensive to list in full here:

From

Cover of Learning Python, 5th Edition

Note

improve speed if put the def inside 'if' route