[Python-Dev] New and Improved Import Hooks

Martin v. Löwis martin@v.loewis.de
Thu, 5 Dec 2002 13:46:04 +0100


> Why don't you care about the backwards incompatibilities?

There is no strict backwards incompatibility: Programs that work now
continue to work, as they will find only strings on sys.path. You only
get problems if you actually add a zipfile to sys.path.

It is unclear to me what the typical breakage would be, and whether it
could be solved in most cases by having the import hooks a string
subclass.

I can imagine a number of potential problems. Code may choke if it
encounters a Unicode string on sys.path (which is possible already), it
may choke if it encounters a non-ASCII byte string on sys.path, it may
choke if it encounters a string that is not a directory name (in which
case you simply can't add zipfile imports without breaking backwards
compatibility).

Regards,
Martin