[Python-Dev] Looking for authoritative documentation on
packages, import & ihooks
Phillip J. Eby
pje at telecommunity.com
Tue Nov 16 16:50:51 CET 2004
At 10:13 AM 11/16/04 -0200, Carlos Ribeiro wrote:
>For example: it is not
>clear, from a simple reading, if PEP 302 is up-to-date, or if it is
>considered the preferred approach for import hooks. For this reason, I
>would like to know if there is any document which may be considered
>"authoritative" for the import system (besides ihooks.py and
>import.c). If *all* that exists is the source code, well, I guess I'll
>have to read it. But anyway... pointers to simple examples also are
>helpful. Thanks in advance.
PEP 302 is essentially up-to-date (although not fully implemented; see the
notes in the PEP), and yes, it's the preferred approach, at least if you're
1) developing an import hook, 2) you're focused on "location" extensions,
i.e. importing from places not currently supported, as opposed to adding
new filetypes or new ways of compiling, etc., and 3) want to interoperate
well with other import hooks.
Regarding the use of other import hook modules such as ihooks and imputil,
they have in the past been the subject of vigorous debate as to which is
the "preferred" way of implementing import hooks. There is also a
separately distributed import hook module, 'iu', that inspired the current
PEP 302 approach. With respect to these various modules, it is apparently
a matter of programmer taste and/or goals as to which is the best.
More information about the Python-Dev
mailing list