Language design
Terry Reedy
tjreedy at udel.edu
Wed Sep 11 19:51:58 EDT 2013
On 9/11/2013 7:19 PM, Ben Finney wrote:
> Er? That doesn't address the task of importing a module from a source
> code file given its path on the filesystem.
>
> Other languages have the equivalent of ‘include "/path/to/file.py"’,
Some includes are equivalent to
with open("/path/to/file.py") as f:
exec(f.read())
> but Python doesn't.
which Python does have.
Python also has __import__("/path/to/file.py"), which is used by import
when the module does not exist.
--
Terry Jan Reedy
More information about the Python-list
mailing list