I would like to get a list of names of built-in modules in python such that I can test the popularity of function’s naming conventions (underline, CamelCase or mixedCase).
I know there is a Global Module Index but I am wondering if there is a list of strings, which is easier to use 🙂
Update:
len(dir(__builtins__)) = 145
len(stdlib_list("2.7")) = 430
help('modules') = 508 # counting manually the output
The compiled-in module names are in
sys.builtin_module_names. For all importable modules, seepkgutil.iter_modules.Run these in a clean
virtualenvto get (almost) only the modules that come with Python itself.Note that a “popularity poll” will necessarily include modules that use old, discouraged naming conventions because they were written before today’s guidelines were put in place, and can’t change because need to be backwards compatible. It might be useful for something, but not for answering best-practice questions such as “How should I name my functions?”. For that, see the PEP8, the Python style guide, especially the “Naming Conventions” section.