A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-December/030857.html below:

[Python-Dev] Another approach for the import mechanism

[Python-Dev] Another approach for the import mechanismBrian Quinlan brian@sweetapp.com
Thu, 05 Dec 2002 16:14:53 -0800
> Of course, if somebody wants to provide a crypt importer (which
> decrypts the source before importing it) in addition to the
> pybz2importer, then you get the same coordination problem as with all
> prior import hooks.

Does anybody really believe that this problem can be solved in general?

I like the following:

1. only strings representing directories are allowed in sys.path 
  (a zip archive is conceptually a directory)
2. there are two types of hook that can be installed:
     - an import hook that returns a module object, a stream object
       or None
     - a stream hook that has the opportunity to return a different
       stream if it likes

When the import hook returns a stream, every stream hook is given a
chance to transform that stream.  If a stream hook returns a transformed
stream then every other hook is called again. This continues until no
stream hook is interested in transforming the stream anymore. 

I know that this might have performance issues, but it seems like it
would allow you to have compressed archives of encrypted modules located
on a web server without any of the hooks knowing anything about each
other.

Cheers,
Brian




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4