On 14/04/2018 06:27, Nick Coghlan wrote:
> On 14 April 2018 at 13:28, Ken Hilton <kenlhil...@gmail.com> wrote:
>> Hi all,
>> First of all, please excuse me if I'm presenting this idea in the wrong way
>> or at the wrong time - I'm new to this mailing list and haven't seen anyone
>> propose a new idea on it yet, so I don't know the customs.
>> I have an idea for importing files with arbitrary names. Currently, the
>> "official" way to import arbitrary files is to use the "imp" module, as
>> shown by this answer: https://stackoverflow.com/a/3137914/6605349
>> However, this method takes two function calls and is not as (aesthetically
>> pleasing? is that the word?) as a simple "import" statement.
> Modules aren't required to be stored on the filesystem, so we have no
> plans to offer this.
> `runpy.run_path()` exists to let folks run arbitrary Python files and
> collect the resulting namespace, while if folks really want to
> implement pseudo-imports based on filenames we expose the necessary
> building blocks in importlib
> The fact that run_path() has a nice straightforward invocation model,
> and the import emulation recipe doesn't is intended as a hint :)
I generally love the current import system for "just working" regardless
of platform, installation details, etc., but what I would like to see is
a clear import local, (as opposed to import from wherever you can find
something to satisfy mechanism). This is the one thing that I miss from
C/C++ where #include <x> is system includes and #include "x" search
differing include paths, (if used well).
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.
This email has been checked for viruses by AVG.
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/