3.2. Python Compatibility
Pacemaker targets compatibility with Python 2.6 and later, and Python 3.2 and later. These versions have added features to be more compatible with each other, allowing us to support both the 2 and 3 series with the same code. It is a good idea to test any changes with both Python 2 and 3.
3.2.1. Python Future Imports
All print statements must use parentheses, and printing without a newline is accomplished with the end=' '
parameter rather than a trailing comma.
All string literals will be treated as Unicode (the u
prefix is unnecessary, and must not be used, because it is not available in Python 3.2).
Local modules must be imported using from . import
(rather than just import
). To import one item from a local module, use from .modulename import
(rather than from modulename import
).
Division using /
will always return a floating-point result (use //
if you want the integer floor instead).