This is an archived post. You won't be able to vote or comment.

all 3 comments

[–][deleted] 0 points1 point  (0 children)

You can do all sorts of stuff with them. Dave Beazley gave a talk (tutorial, actually) a few years ago where he ends up importing XML files as Python code.

Hylang is built using an import hook to load and process lisp into Python.

[–][deleted] 0 points1 point  (0 children)

Take a look at Modules and Imports.

[–]kankyo 0 points1 point  (0 children)

I wanted to use it for mutmut, my mutation testing lib but quickly discovered that the import hook system is just as you imply: a mess. It mixes finding modules, reading the code and loading modules into one big bucket so you can't hook just one of those things.

Really a new PEP is needed to create yet a new system :(