[stdlib-sig] Proposal: new "interpreter" module

Benjamin Peterson musiccomposition at gmail.com
Fri Apr 4 18:51:28 CEST 2008

On Fri, Apr 4, 2008 at 10:27 AM, Benjamin Peterson <
musiccomposition at gmail.com> wrote:

> On Fri, Apr 4, 2008 at 10:01 AM, Steven Bethard <steven.bethard at gmail.com>
> wrote:
> > On Fri, Apr 4, 2008 at 11:27 AM, Christian Heimes <christian at cheimes.de>
> > wrote:
> > >  Once the pyvm module is implemented the sys module should only
> > contain
> > >  system methods which can be implemented by all flavors of Python.
> >
> > On Fri, Apr 4, 2008 at 5:44 AM, Brett Cannon <brett at python.org> wrote:
> > > This is exactly the type of separation I want to see.
> > [snip]
> > > Sound good to people? If so, who wants to take this on?
> >
> > 2008/4/4 Benjamin Peterson <musiccomposition at gmail.com>:
> > > If there is further support, I will.
> >
> > I don't know how much more further support you need, but I'm 100%
> > behind the idea. If you need any more help, let me know.
> I'm starting the PEP now...
And here it is: This is my first PEP, so do be brutal with your feedback.

Title: The interpreter module
Version: $Revision$
Last-Modified: $Date$
Author: Benjamin Peterson
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 4-April-2008
Python-Version: 3.0


This PEP proposes a new low-level module for CPython-specific interpreter
functions in order to clean out the sys module and separate general Python
functionality from implementation details.


The sys module currently contains functions and data that can be put into
major groups:

1. Data and functions that are available in all Python implementations and
   with the general running of a Python VM.

   - display_hook, stdout, stdin, and stderr
   - flags and warn_options
   - settrace, and setprofile
   - traceback, excepthook
   - etc...

2. Data and function that affect the CPython interpreter.

   - get/setrecursionlimit
   - get/setcheckinterval
   - _getframe and _current_frame
   - getrefcount
   - getdlopenflags

The second collections of items has been steadily increasing over the years
causing clutter in sys.  Guido has even said he doesn't recognize some of
in it [#bug-1522]_!

Other implementations have clearly struggled with what to do about the
of sys they can't implement but must to retain compatibility.  For example,
Jython's sys module has dud set/getrecursionlimit functions.  Moving these
items off to another module would send a clear message about what functions
and need not be implemented.

It has also been proposed that the contents of types module be distributed
across the standard library [#types-removal]_; the interpreter module would
provide an excellent resting place for internal types like frames and code


A new builtin module named "interpreter" (see `Naming`_) will be added.  The
functions mentioned in the above list will be moved to it.

Transition Plan

Once implemented in 3.x, the interpreter module will be back-ported to 2.6.
Py3k warnings will be added the the sys functions it replaces.

Open Issues


The author proposes the name "interpreter" for the new module.  "pyvm" has
been suggested [#pyvm-name]_.


.. [#bug-1522]


.. [#types-removal]


.. [#pyvm-name]



    This document has been placed in the public domain.

Local Variables:
mode: indented-text
indent-tabs-mode: nil
sentence-end-double-space: t
fill-column: 70
coding: utf-8

> >
> > Steve
> > --
> > I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
> > tiny blip on the distant coast of sanity.
> >        --- Bucky Katt, Get Fuzzy
> >
> --
> Cheers,
> Benjamin Peterson

Benjamin Peterson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/stdlib-sig/attachments/20080404/7965f3eb/attachment.htm 

More information about the stdlib-sig mailing list