Running the examples in this book
The code examples in this book have been written for Python 3.4. They use some syntax that is not available in older versions of Python. Therefore, there are a few places we will need to change the code if we want to run the examples in, say, Python 2.6.
Note
The entire source code with all the changes below is available online at https://github.com/siddhi/test_driven_python. Get this code if you would like to run the example code in this book under Python 2.6, 2.7, 3.0, 3.1, 3.2, or 3.3
The following changes are required:
Enum
: TheEnum
library is not in the standard library with older Python versions. It has been backported and can be installed from PyPi. Install theEnum34
library to use this feature.set
syntax: Newer versions of Python support the single curly braces shorthand syntax to createset
objects like{"MSFT"}
. In older versions, we will need to explicitly create sets with this equivalent longhand syntax:set(["MSFT"])
.print
...