This module essentially performs introspection on the Python interpreter itself, to discover which language features are available.
Usage notes:
The recommended way to use this module is:
from boodebr.pyconfig import pyconfig # or 'import *'
if pyconfig.Have_Iterators():
...
Using the 'pyconfig' object like this auto-caches results so you can use the function calls inline without a speed penalty of rerunning the test each time.
Background/rationale:
At first glance, this module seems odd — why not just check sys.version_info? Well, for example:
- You could be running under a nonstandard/alternative Python implementation (e.g. Jython, or maybe a cut-down embedded version that eliminated some features) and you want to dynamically figure out what is available.
- You're writing an installer, and want to pick different modules to install, based on platform.