Attempts to ensure the ``callable`` builtin is available.
Attempts to ensure the callable builtin is available.
- On versions of Python where callable is already available, importing this doesn’t break anything and leaves callable alone.
- On versions without a callable builtin, on import this will attempt to inject an equivalent implementation, so that code invoking callable continues to work.
- If your Python runtime has no callable builtin and this module is unable to polyfill it, it will raise a NotImplementedError.
This library’s version numbers follow the SemVer 2.0.0 specification.
pip install polyfill-callable
Just make sure you run this before you run any other code that uses callable:
You can also catch NotImplementedError if you’d like to gracefully handle the lack of callable:
try: import polyfill_callable except NotImplementedError as error: # .. do something ..
Currently, this module only has a callable polyfill for:
- The early CPython 3 versions that shipped without callable before it was added back in in CPython 3.2. There we can reimplement it using ctypes, and polyfill it into the global namespace by using builtins.
If there are other Python implementation versions where it would be possible to support a polyfill, they might eventually be added here.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size polyfill_callable-1.0.1-py2.py3-none-any.whl (4.3 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size polyfill-callable-1.0.1.tar.gz (3.4 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for polyfill_callable-1.0.1-py2.py3-none-any.whl