On Mon, Oct 27, 2008 at 12:31 PM, <[EMAIL PROTECTED]> wrote: > On 07:24 pm, [EMAIL PROTECTED] wrote: >> >> On Mon, Oct 27, 2008 at 3:50 AM, Nick Coghlan <[EMAIL PROTECTED]> wrote: >>> >>> Brett Cannon wrote: > >> Good enough for me. Then I am just going to ignore the 'path' argument >> for frozen modules but use it to short-circuit imports for built-in >> modules. > > For what it's worth, Twisted uses the __path__ attribute to facilitate its > plugin mechanism. > If this changes so that importing from frozen packages no > longer honors __path__, then Twisted will no longer support plugins if the > package to be plugged into is frozen. >
But how do you manipulate it for frozen packages currently? Importing a frozen package currently has a bad __path__ value:: >>> import __phello__; __phello__.__path__ '__phello__' Notice how that is not a list. Do you special-case frozen packages? > What is the motivation to change this? Ease of implementation for me (this has not gone far enough to be an official change; as of this moment this is just for my import rewrite vaporware). imp.is_frozen() tells you whether a module is frozen or not, and thus whether to use imp.init_frozen(). So implementing a meta_path importer for frozen modules can be nothing more than calls to imp.is_frozen() and imp.init_frozen() if you just ignore the 'path' argument. -Brett _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com