Re: How best to replace imp.load_module()?
Brett Cannon <[email protected]> Sat, 5 Apr 2014 09:58:23 -0400
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <CAP1=2W6DkK44SK_iJDWnB+Db4+U2tPW9PnVqGwN_Y9NAC2iBBQ@mail.gmail.com> |
On Fri, Apr 4, 2014 at 8:07 PM, Nick Coghlan <[email protected]> wrote: > Keep in mind I already need a fair bit of this kind of thing to make runpy > work properly. > OK, that's good to know. > Moving that infrastructure to importlib.util is worthwhile, because it > makes it easier to evolve the core import implementation with confidence > that we're not breaking even obscure use cases. > > The migration of extension modules to PEP 451 should take place on the > road to 3.5, and we should take a close look at migrating pdb and friends > to runpy with a view to adding -m support (which may require new features > in runpy itself). > SGTM > Moving zipimport to a frozen Python module may also be desirable. > I think the amount of dependencies might make this more of a pain than it's worth. I asked Greg and Thomas if they thought it might be worth it after all the headaches they went through for zipimport and they didn't think it necessarily worth it. While I would be quite happy if someone actually tried to figure out the feasibility (maybe running zipfile through modulefinder is enough to get an idea?), I just don't know if the level of dependency will be so high that it will just get annoying short of freezing the entire stdlib (which in and of itself might be an interesting exercise, although I would see some flipping out over the increased binary size). > I think that's a better use case driven path to follow, and we can hold > off on finalising the imp.load_module deprecation for the time being. > Well, it's been explicitly deprecated since Python 3.3 (3.3 had a DeprecationWarning in the function, 3.4 has it implicitly through the module-level deprecation). But actual removal won't happen until we do a deprecation spring cleaning in the stdlib (e.g. Python 4 kind of thing). Anyway, I'll wait until you're ready to work on runpy stuff to worry about what exactly we want to support so as to not go stabbing in the dark as trying to get average use cases has been hard to come by (GitHub actually suggests very few people use load_module() w/o find_module() which makes this easier to deal with). -Brett > Cheers, > Nick. > _______________________________________________ Import-SIG mailing list [email protected] https://mail.python.org/mailman/listinfo/import-sig