On 24/11/2013 14:15, Steven D'Aprano wrote:
That was the case up to 3.3, but Python 3.4 has the import machinery re-
written in pure Python (except for a tiny bit of bootstrapping machinery,
if I understand correctly). I understand that nobody understood the
import machinery in full (although th
On Mon, Nov 25, 2013 at 1:15 AM, Steven D'Aprano
wrote:
> On Sun, 24 Nov 2013 19:07:38 +1100, Chris Angelico wrote:
>
>> I know the recent Pythons give a lot of import power to the script. But
>> maybe I'm just asking too much, and some of this stuff really is magical
>> and implemented in C?
>
>
On Sun, 24 Nov 2013 19:07:38 +1100, Chris Angelico wrote:
> I know the recent Pythons give a lot of import power to the script. But
> maybe I'm just asking too much, and some of this stuff really is magical
> and implemented in C?
That was the case up to 3.3, but Python 3.4 has the import machine
On Sun, Nov 24, 2013 at 4:05 AM, Chris Angelico wrote:
> Undocumented... that explains why I didn't know about it! But that
> does appear to be what I'm looking for, so is there some equivalent
> planned as a replacement?
Hmm, playing around with importlib a bit, this seems to work:
from importl
On Sun, Nov 24, 2013 at 8:50 PM, Ian Kelly wrote:
> On Sun, Nov 24, 2013 at 2:18 AM, Christian Gollwitzer wrote:
>> Am 24.11.13 04:41, schrieb Chris Angelico:
>>
>>> As part of a post on python-ideas, I wanted to knock together a quick
>>> little script that "imports" a file based on its name, in
On Sun, Nov 24, 2013 at 2:18 AM, Christian Gollwitzer wrote:
> Am 24.11.13 04:41, schrieb Chris Angelico:
>
>> As part of a post on python-ideas, I wanted to knock together a quick
>> little script that "imports" a file based on its name, in the same way
>> that the Python interpreter will happily
Am 24.11.13 04:41, schrieb Chris Angelico:
As part of a post on python-ideas, I wanted to knock together a quick
little script that "imports" a file based on its name, in the same way
that the Python interpreter will happily take an absolute pathname for
the main script.
Is it imp.load_source()
On Sun, Nov 24, 2013 at 7:00 PM, Ian Kelly wrote:
> The importer mechanism as far as I know only accepts module names, not
> filesystem paths; I believe this is by design. You could imitate it by
> doing something like this:
>
> import imp
> import sys
>
> mod = imp.new_module('spam')
> exec(open
On Nov 23, 2013 9:42 PM, "Chris Angelico" wrote:
> As part of a post on python-ideas, I wanted to knock together a quick
> little script that "imports" a file based on its name, in the same way
> that the Python interpreter will happily take an absolute pathname for
> the main script. I'm sure th
On Sat, Nov 23, 2013 at 7:41 PM, Chris Angelico wrote:
> As part of a post on python-ideas, I wanted to knock together a quick
> little script that "imports" a file based on its name, in the same way
> that the Python interpreter will happily take an absolute pathname for
> the main script. I'm su
As part of a post on python-ideas, I wanted to knock together a quick
little script that "imports" a file based on its name, in the same way
that the Python interpreter will happily take an absolute pathname for
the main script. I'm sure there's a way to do it, but I don't know
how. Obviously the i
11 matches
Mail list logo