Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95224

Re: Importing is partially working...

References <D1ED09E0.10CC86%Dwight@GoldWinde.com> <CAPTjJmrPQ2PUnh46+C_=eKp8cy0nEtz4+P9k2qAeJYFxLopXcg@mail.gmail.com> <55C8C7EB.6020401@mrabarnett.plus.com>
Date 2015-08-11 02:08 +1000
Subject Re: Importing is partially working...
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.45.1439222936.3627.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Aug 11, 2015 at 1:48 AM, MRAB <python@mrabarnett.plus.com> wrote:
>> You're almost there! But in Python, you don't import something from a
>> specific file - you import from a module, and the Python interpreter
>> is free to locate that file anywhere that it can. It might be
>> implemented in C, and be stored in Functions.so (on Unix-like systems)
>> or Functions.dll (on Windows); it might be precompiled and loaded from
>> Functions.pyc; it might come from a zip file, or some other form of
>> special import source. So all you say is:
>>
> On Windows, the extension for Python extension DLLs is ".pyd".

Or that. I haven't built any Python extensions in, well, ever, and
haven't even deployed other people's in years, so I'm a bit rusty.
Anyway, point is you don't have to care where it actually comes from.

The one thing that I do kinda miss in Python is an easy way to "shadow
and pull in the original" - to create something earlier in the search
path, but then have that file get a reference to "the module that
would have been loaded if I hadn't been here". It's not often you want
it, but quite frankly, I don't know how I'd spell it at all. There
probably is a way, but I've no idea what it is...

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Importing is partially working... Chris Angelico <rosuav@gmail.com> - 2015-08-11 02:08 +1000

csiph-web