[Python-ideas] Move more parts of interpreter core to stdlib
Nick Coghlan
ncoghlan at gmail.com
Tue Aug 27 12:13:33 CEST 2013
More information about the Python-ideas mailing list
Tue Aug 27 12:13:33 CEST 2013
- Previous message: [Python-ideas] Move more parts of interpreter core to stdlib
- Next message: [Python-ideas] Allow multiple arguments to `list.remove` and flag for silent fail
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 27 Aug 2013 03:57, "Antoine Pitrou" <solipsis at pitrou.net> wrote: > > On Mon, 26 Aug 2013 16:36:53 +0200 > Draic Kin <drekin at gmail.com> wrote: > > Hello, it would be nice if reference pure Python implementation existed for > > more parts of interpreter core and the core actually used them. This was > > done for import machinery in Python 3.3 making importlib library. > > > > One potential target for this would be moving the logic of what python.exe > > does – parsing its arguments, finding the script to run, compiling its code > > and running as __main__ module, running REPL if it's in interactive mode > > afterwards. There could be a stdlib module exposing this logic, using > > argparse to parse the arguments, overhauled version of runpy to run the > > __main__ module and overhauled version of code to run the REPL. Python.exe > > would be just thin wrapper which bootstraps the interpreter and runs this > > runner module. > > The interpreter needs a lot of information to be bootstrapped; you are > proposing that the code which extracts that information be run *after* > the interpreter is bootstrapped, which creates a nasty temporal problem. > > In the end, it may make maintenance *more* difficult, rather than less, > to rewrite that code in Python. Enabling more of this kind of thing with frozen modules is actually one of my motivations for PEP 432. It can't be done readily until we have a clear separation of "working compiler, event loop and builtin types" from "fully configured interpreter instance", though. runpy.run_path and run_module unfortunately need updating before they can be used to fully emulate normal __main__ execution (the -m switch uses an underscore prefixed private API). There's a tracker issue about those updates that the various authors of a third party runpy alternatives may care to investigate. The problem with the current APIs is you can't run in a preexisting namespace and you can't get the partially populated namespace after an exception. Aside from that, the test suite ensures that the runpy functions gives the same behaviour as the command line (in the case of module execution, that *is* running almost exactly the same code already). Cheers, Nick. > > Regards > > Antoine. > > > _______________________________________________ > Python-ideas mailing list > Python-ideas at python.org > http://mail.python.org/mailman/listinfo/python-ideas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130827/1cc56184/attachment.html>
- Previous message: [Python-ideas] Move more parts of interpreter core to stdlib
- Next message: [Python-ideas] Allow multiple arguments to `list.remove` and flag for silent fail
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list