Module name does not match file name

Robert Kern robert.kern at gmail.com
Mon Jul 7 10:25:36 EDT 2014


On 2014-07-07 12:56, Steven D'Aprano wrote:
> On Mon, 07 Jul 2014 12:15:51 +0100, Robert Kern wrote:
>
>> On 2014-07-07 09:57, Steven D'Aprano wrote:
>>> What I don't understand is how "import pg" gets turned into "run
>>> pgmodule.so"?
>>
>> This has been standard Python behavior for extension modules since
>> forever. It's a very old practice and not recommended for new code,
>> though.
>
> Hmmm. Well, that is very special. Is this documented anywhere?

Not that I can find. Maybe the PEP that removed it for Python 3 might document 
it implicitly.

> I know very little about extension modules. If I just rename the source
> file from pgmodule.c to pg.c, recompile to pg.so, and use that in place
> of pgmodule.so, is anything likely to break?

I don't think so, but why would you bother (assuming you aren't the maintainer 
of pgmodule.so)?

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list