Let's say I built a package with a Python module and an extension module in it, but with the identical name
mypackage
|
+-- __init__.py
|
+-- mymodule.py
|
+-- mymodule.cpython-39-x86_64-linux-gnu.so
I have found that when I do from mypackage import mymodule
, it is the extension module that is being imported. I wonder why this is the case? Does extension modules take precedence during imports? If so, could anyone point to where this behavior is documented?