Skip to main content

Attempts to ensure the ``callable`` builtin is available.

Project description

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:

import polyfill_callable

You can also catch NotImplementedError if you’d like to gracefully handle the lack of callable:

    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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for polyfill-callable, version 1.0.1
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

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page