At 03:28 AM 7/15/2007 +1000, Nick Coghlan wrote: >Jim Jewett wrote: > > If anything, I would like to see the -m option enhanced so that if it > > gets a recognized "collection" file type (including a directory or > > zip), it does the right thing. Whether that actually makes sense, or > > defeats the purpose of the -m shortcut, I'm not sure. > >-m deals with the package namespace as it already stands - it knows >nothing whatsoever about the underlying filesystem (and that's >deliberate - the runpy module relies on PEP 302 to abstract away all >those details). > >On Phillip's idea regarding being able to execute directories and zip >files, I think the semantics would actually be manageable (as >directories and zip files can be definitely identified), but I'd be >concerned as to the startup cost for checking what is being executed.
Well, the start file is being opened and checked for directory-ness already, and it has to be read to be executed. The extra reading to see if it's a zipfile isn't likely to be much additional overhead. At this point I've got a partial patch. It figures out when it should import __main__, but it's not successful at actually doing so. It seems that simply importing or reloading '__main__' doesn't work, because it's considered a built-in module. Apparently, I'll have to explicitly load the module via the found importer. _______________________________________________ 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