import hooks (PEP 302) broken in Python >=2.5?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Aug 7 14:41:20 EDT 2011


Josh Haberman wrote:

> When reading about import hooks, I came across a blog entry comment
> that says:
> 
>   One additional thing to note about ihooks is that it's
>   somewhat seriously broken on Python 2.5 and newer and there
>   seems to be little or no interest in fixing it. It's
>   probably worth *always* avoiding when writing new code.
> 
> --http://orestis.gr/blog/2008/12/20/python-import-hooks/#c264
> 
> Does anyone know what this is referring to?  Should I be wary of
> relying on import hooks?

Are you using import hooks? What version(s) of Python are you using?

Depending on whether you are asking out of curiosity, or because you have
code that uses import hooks and you're about to migrate from Python 2.3 to
3.1, the answers may be different.



-- 
Steven




More information about the Python-list mailing list