Use forward-compatible python (part 1).

### Motivation
Since we are targeting Python 2.7+, we should start using syntax and features that are forward-compatible with Python 3. This PR incorporates some suggestions made by the [python-modernize](https://github.com/mitsuhiko/python-modernize) tool.

### Changelog 
* Fix a few problems with booleans.
* Use new octal notation (PEP 3127).

### Roadmap
There will possibly be subsequent PRs targeting:
* `import`s
* `print` statements (port to Python 3 syntax using `__future__`)