Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9226183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:46:07+00:00 2026-06-18T04:46:07+00:00

How can I determine whether a Python module is part of the standard library?

  • 0

How can I determine whether a Python module is part of the standard library?
In other words: is there a Python equivalent of perl’s corelist utility?

I would use this to set my expectations on portability during development.
In case it’s implementation dependent, I’m interested in CPython.

The best answer I found so far is this:

Which parts of the python standard library are guaranteed to be available?

That is to search for the module name on the index page of the Python Standard Library Documentation: http://docs.python.org/2/library/. However, this is less convenient than having a utility and also does not tell me anything about minimally required versions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:46:08+00:00Added an answer on June 18, 2026 at 4:46 am

    When using a setuptools install script (setup.py), you test for the required module, and update the installation dependencies list to add backports if needed.

    For example, say you need the collections.OrderedDict class. The documentation states it was added in Python 2.7, but a backport is available that works on Python 2.4 and up. In setup.py you test for the presence of the class in collections. If the import fails, add the backport to your requirements list:

    from setuptools import setup
    
    install_requires = []
    
    try:
        from collections import OrderedDict
    except ImportError:
        install_requires.append('ordereddict')
    
    setup(
        # ...
        install_requires=install_requires
    )
    

    then in your code where you need OrderedDict use the same test:

    try:
        from collections import OrderedDict
    except ImportError:
        # use backported version
        from ordereddict import OrderedDict
    

    and rely on pip or easy_install or zc.buildout or other installation tools to fetch the extra library for you.

    Many recent core library additions have backports available, including json (called simplejson), argparse, sqlite3 (the pysqlite package, use from pysqlite2 import dbapi as sqlite3 as a fallback).

    You’ll still have to read the documentation; the Python documentation is excellent, and for new modules, classes, methods, functions or arguments the documentation mentions explicitly in what Python version they were added.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are two polygons given. how can one determine whether one polygon is inside,
Is there a sensible way to determine whether the current user can access an
It seems to me that there are four different ways I can determine whether
How can I determine programmatically whether my machine is an x86, x64 or an
How can I use jQuery to determine whether an element has a certain style
Given an Youtube video id how can I determine from JavaScript whether the video
How can I determine type of mysql database : whether it is InnoDB or
I need a library which will take in two regular expressions and determine whether
How can I determine whether a headset is plugged into an Android device or
May I know how can I determine whether a component is found in JPanel?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.