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
for
On Mon, Jul 7, 2014 at 9:56 PM, Steven D'Aprano
wrote:
> Hmmm. Well, that is very special. Is this documented anywhere?
"Special", in the sense of Shepherd Book addressing Mal. "Isn't
that... special."
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
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
On 2014-07-07 09:57, Steven D'Aprano wrote:
Ah, I think I have a partial answer... but not a complete answer.
On Mon, 07 Jul 2014 07:57:21 +, Steven D'Aprano wrote:
Can anyone explain how "import pg" can end up coming from pgmodule.so?
Sure enough:
import pg
pg.__file__
'/usr/local/l
Steven D'Aprano wrote:
> Ah, I think I have a partial answer... but not a complete answer.
>
>
> On Mon, 07 Jul 2014 07:57:21 +, Steven D'Aprano wrote:
>
>> Can anyone explain how "import pg" can end up coming from pgmodule.so?
>>
>>
>> Sure enough:
>>
> import pg
> pg.__file__
>
On Mon, 07 Jul 2014 19:03:33 +1000, Chris Angelico wrote:
> On Mon, Jul 7, 2014 at 6:57 PM, Steven D'Aprano
> wrote:
>> which suggests that the pgmodule.so file creates a module called "pg".
>> What I don't understand is how "import pg" gets turned into "run
>> pgmodule.so"?
>
> What happens if
On Mon, Jul 7, 2014 at 7:03 PM, Steven D'Aprano wrote:
> On Mon, 07 Jul 2014 18:04:36 +1000, Chris Angelico wrote:
>
>> On Mon, Jul 7, 2014 at 5:57 PM, Steven D'Aprano
>> wrote:
>>> Can anyone explain how "import pg" can end up coming from pgmodule.so?
>>
>> First guess: There's a "pg.py" somewhe
On Mon, 07 Jul 2014 18:04:36 +1000, Chris Angelico wrote:
> On Mon, Jul 7, 2014 at 5:57 PM, Steven D'Aprano
> wrote:
>> Can anyone explain how "import pg" can end up coming from pgmodule.so?
>
> First guess: There's a "pg.py" somewhere that imports the so, then
> replaces itself in sys.modules.
On Mon, Jul 7, 2014 at 6:57 PM, Steven D'Aprano wrote:
> which suggests that the pgmodule.so file creates a module called "pg".
> What I don't understand is how "import pg" gets turned into "run
> pgmodule.so"?
What happens if you *don't* import pg? Is there a sys.modules["pg"]
already? If so, I'
Ah, I think I have a partial answer... but not a complete answer.
On Mon, 07 Jul 2014 07:57:21 +, Steven D'Aprano wrote:
> Can anyone explain how "import pg" can end up coming from pgmodule.so?
>
>
> Sure enough:
>
import pg
pg.__file__
> '/usr/local/lib/python2.6/dist-packages/
On Mon, Jul 7, 2014 at 5:57 PM, Steven D'Aprano wrote:
> Can anyone explain how "import pg" can end up coming from pgmodule.so?
First guess: There's a "pg.py" somewhere that imports the so, then
replaces itself in sys.modules.
# importme.py
import sys
sys.modules["importme"]=sys
>>> import imp
11 matches
Mail list logo