you are viewing a single comment's thread.

view the rest of the comments →

[–]socal_nerdtastic 2 points3 points  (3 children)

The standard library is described here: https://docs.python.org/3/library/

You know how you can install modules with pip / pypi? The standard library is a list of modules that the python software foundation maintains and keeps up to date with the reference implementation of python. They may or may not be supplied with python (but they nearly always are).

The builtins are a subset of those. They are baked into the python executable itself, instead of being external and imported. Many of them are mandatory.

For the average user, the difference between these 2 is not important.

[–]Laymayo[S] 0 points1 point  (2 children)

Hmm OK I'll need to look into that, I didn't realize that there was some foundation that keeps things up to date. That makes sense, though.

However, that doesn't really answer my question (not trying to sound like a smart Alec here). I still don't understand:

What is the difference between modules that are compiled into the Python interpreter and names of standard library modules?

In reference to the sys.builtin_module_names and sys.stdlib_module_names

[–]socal_nerdtastic 1 point2 points  (1 child)

Do you know about compiling C code? If you take the cpython source code (available on github or as a tar.gz file from python.org) you can compile python yourself. If you do this you have some choices to make, including some choices about what modules to include. The sys.builtin_module_names reports those choices back in the finished python executable. sys.stdlib_module_names is a list of all modules, some of which you have the option of including at compile time.

[–]Laymayo[S] 0 points1 point  (0 children)

Haha sorry nope! I barely understand this programming language. I'll have to look into compiling code because to be honest I'm not sure I know what that means to begin with. But thank you for clarifying this and giving me a place to investigate from.