Reputation: 151
Curious about how Python's itertools.product
was implemented, I took to searching the C:\Python27 directory. Could not find it. This lead me to post these related questions:
I understand that the statement import xyzabc
reads a module from some place (possibly where the environment variable directs it), but since I found no module itertools
, 1) how is it being imported? and 2) can someone point me to that implementation? (or is it written is C, so that I will have trouble reading it?)
Mildly related: 3) is anything Python "closed source"?
Upvotes: 1
Views: 58
Reputation: 601759
The itertools
module is one of the modules compiled directly into the interpreter; see sys.builtin_module_names
for a full list of these modules.
The itertools module is implemented in C, see e.g. its Python 2.7 source code.
No, all of the CPython implementation is open.
Upvotes: 3