Re: PEP 451: Big update.

Brett Cannon <[email protected]> Thu, 19 Sep 2013 10:11:52 -0400
Newsgroups gmane.comp.python.import
Message-ID <CAP1=2W4T3ETcqw1Xt7aQxzLQbsBu4bbqjPWdyF8_er34oUrygQ@mail.gmail.com>
On Thu, Sep 19, 2013 at 6:22 AM, Antoine Pitrou <[email protected]> wrote:

>
> Hi,
>
> I have some questions and comments:
>
> > origin - a string for the location from which the module is loaded,
> > e.g. "builtin" for built-in modules and the filename for modules
> > loaded from source.
>
> Filename or filepath? What if the module is stored in e.g. a ZIP file?
>

I think this would be what __file__ would be set to for zipfiles, so for
zip files it would be e.g. /some/file.zip/path/to/module.py


>
> > submodule_search_locations - list of strings for where to find
> > submodules, if a package (None otherwise).
>
> Why isn't is_package exposed as an attribute too?
>

It's redundant. The test for whether something is a package is literally
``submodule_search_locations is not None``. It just doesn't isn't
complicated enough to warrant another attribute. Plus being a package isn't
as important per-se as a concept as much as having a search path.


>
> > cached (property) - a string for where the compiled module will be
> > stored
>
> "where" is a filesystem location?
> (absolute? relative to the origin?)
>

It's what http://docs.python.org/3/library/imp.html#imp.cache_from_source would
return.


>
> > has_location (RO-property) - the module's origin refers to a location.
>
> filesystem location? What about ZIP files?
>

It's a flag to basically say that origin contains what __file__ should be.

-Brett


>
> > spec_from_file_location(name, location, *, loader=None,
> > submodule_search_locations=None) - factory for file-based module specs
>
> What does it mean? Is it able to make "intelligent" decisions depending
> on e.g. whether the module is an extension module or a pure Python
> module?
>
> > from_loader(name, loader, *, origin=None, is_package=None) - factory
> > based on information provided by loaders.
>
> That description is rather unhelpful.
>
> > importlib.find_spec(name, path=None) will return the spec for a module.
>
> Is the module supposed to be already loaded or not? How is the spec
> "found"?
>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Import-SIG mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/import-sig
>

_______________________________________________
Import-SIG mailing list
[email protected]
https://mail.python.org/mailman/listinfo/import-sig