<br><br><div class="gmail_quote">On Sun, Apr 6, 2008 at 3:09 AM, Brett Cannon &lt;<a href="mailto:brett@python.org">brett@python.org</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Sat, Apr 5, 2008 at 11:11 PM, Benjamin Peterson<br>
<div><div></div><div class="Wj3C7c">&lt;<a href="mailto:musiccomposition@gmail.com">musiccomposition@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Sat, Apr 5, 2008 at 4:04 PM, Brett Cannon &lt;<a href="mailto:brett@python.org">brett@python.org</a>&gt; wrote:<br>
&gt; &gt; On Sat, Apr 5, 2008 at 6:13 PM, Benjamin Peterson<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; &lt;<a href="mailto:musiccomposition@gmail.com">musiccomposition@gmail.com</a>&gt; wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; On Sat, Apr 5, 2008 at 10:37 AM, Brett Cannon &lt;<a href="mailto:brett@python.org">brett@python.org</a>&gt; wrote:<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; On Sat, Apr 5, 2008 at 4:58 PM, Benjamin Peterson<br>
&gt; &gt; &gt; &gt; &lt;<a href="mailto:musiccomposition@gmail.com">musiccomposition@gmail.com</a>&gt; wrote:<br>
&gt; &gt; &gt; &gt; &gt; Here&#39;s an updated version:<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &nbsp; &nbsp;- display_hook, stdout, stdin, and stderr<br>
&gt; &gt; &gt; &gt; &gt; &nbsp; &nbsp;- flags and warn_options<br>
&gt; &gt; &gt; &gt; &gt; &nbsp; &nbsp;- settrace, and setprofile<br>
&gt; &gt; &gt; &gt; &gt; &nbsp; &nbsp;- traceback, excepthook<br>
&gt; &gt; &gt; &gt; &gt; &nbsp; &nbsp;- etc...<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; You still need to get rid of the &quot;etc.&quot;. Beyond being explicit, it<br>
&gt; &gt; &gt; &gt; makes it easier for people reviewing the PEP to see what they think<br>
&gt; &gt; &gt; &gt; might be better placed in the new module.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; PEP: XXX<br>
&gt; &gt; &gt; Title: The interpreter module<br>
&gt; &gt; &gt; Version: $Revision$<br>
&gt; &gt; &gt; Last-Modified: $Date$<br>
&gt; &gt; &gt; Author: Benjamin Peterson<br>
&gt; &gt; &gt; Status: Draft<br>
&gt; &gt; &gt; Type: Standards Track<br>
&gt; &gt; &gt; &nbsp;Content-Type: text/x-rst<br>
&gt; &gt; &gt; Created: 4-April-2008<br>
&gt; &gt; &gt; Python-Version: 3.0<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Abstract<br>
&gt; &gt; &gt; ========<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; This PEP proposes a new low-level module for CPython-specific<br>
&gt; interpreter<br>
&gt; &gt; &gt; functions in order to clean out the sys module and separate general<br>
&gt; Python<br>
&gt; &gt; &gt; &nbsp;functionality from implementation details.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Rationale<br>
&gt; &gt; &gt; =========<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; The sys module currently contains functions and data that can be put<br>
&gt; into<br>
&gt; &gt; &gt; two<br>
&gt; &gt; &gt; major groups:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; 1. Data and functions that are available in all Python implementations<br>
&gt; and<br>
&gt; &gt; &gt; deal<br>
&gt; &gt; &gt; &nbsp; &nbsp; with the general running of a Python VM.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &nbsp; &nbsp;- argv<br>
&gt; &gt; &gt; &nbsp; &nbsp;- byteorder<br>
&gt; &gt; &gt; &nbsp; &nbsp;- builtin_module_names, path, and modules<br>
&gt; &gt;<br>
&gt; &gt; builtin_module_names is an implementation detail and thus should be moved.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; &gt; &nbsp; &nbsp;- subversion, copyright, hexversion, version, and version_info<br>
&gt; &gt;<br>
&gt; &gt; Ditto for subversion.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; &gt; &nbsp; &nbsp;- displayhook, __displayhook__<br>
&gt; &gt; &gt; &nbsp; &nbsp; - excepthook, __excepthook__, exc_info, and exc_clear<br>
&gt; &gt; &gt; &nbsp; &nbsp;- exec_prefix and prefix<br>
&gt; &gt; &gt; &nbsp; &nbsp;- executable<br>
&gt; &gt; &gt; &nbsp; &nbsp;- exit<br>
&gt; &gt; &gt; &nbsp; &nbsp;- flags, py3kwarning, dont_write_bytecode, and warn_options<br>
&gt; &gt;<br>
&gt; &gt; dont_write_bytecode might be better off in the new module, but then<br>
&gt; &gt; bytecode is part of the stdlib. I guess it depends on how the other<br>
&gt; &gt; interpreters view bytecode. They could easily just have it always set<br>
&gt; &gt; to False.<br>
&gt; What do you think about moving it to imp.<br>
&gt;<br>
<br>
</div></div>Fine by me, but some people still seem to think this is an<br>
implementation detail. Since there is a lack of a clear solution for<br>
this I say make it an Open Issue and wait until python-dev is brought<br>
into this to figure it out.</blockquote><div>Ok. Here&#39;s another version:<br><br>PEP: XXX<br>Title: Cleaning out sys and the interpreter module<br>Version: $Revision$<br>Last-Modified: $Date$<br>Author: Benjamin Peterson<br>
Status: Draft<br>Type: Standards Track<br>Content-Type: text/x-rst<br>Created: 4-April-2008<br>Python-Version: 3.0<br><br><br>Abstract<br>========<br><br>This PEP proposes a new low-level module for CPython-specific interpreter<br>
functions in order to clean out the sys module and separate general Python<br>functionality from implementation details.<br><br><br>Rationale<br>=========<br><br>The sys module currently contains functions and data that can be put into two<br>
major groups:<br><br>1. Data and functions that are available in all Python implementations and deal<br>&nbsp;&nbsp; with the general running of a Python VM.<br><br>&nbsp;&nbsp; - argv<br>&nbsp;&nbsp; - byteorder<br>&nbsp;&nbsp; - builtin_module_names, path, and modules<br>
&nbsp;&nbsp; - copyright, hexversion, version, and version_info<br>&nbsp;&nbsp; - displayhook, __displayhook__<br>&nbsp;&nbsp; - excepthook, __excepthook__, exc_info, and exc_clear<br>&nbsp;&nbsp; - exec_prefix and prefix<br>&nbsp;&nbsp; - executable<br>&nbsp;&nbsp; - exit<br>&nbsp;&nbsp; - flags, py3kwarning, dont_write_bytecode, and warn_options<br>
&nbsp;&nbsp; - getfilesystemencoding<br>&nbsp;&nbsp; - get/setprofile<br>&nbsp;&nbsp; - get/settrace<br>&nbsp;&nbsp; - getwindowsversion<br>&nbsp;&nbsp; - maxint and maxunicode<br>&nbsp;&nbsp; - platform<br>&nbsp;&nbsp; - ps1 and ps2<br>&nbsp;&nbsp; - stdin, stderr, stdout, __stdin__, __stderr__, __stdout__<br>
&nbsp;&nbsp; - tracebacklimit<br>&nbsp;&nbsp; <br><br>2. Data and functions that affect the CPython interpreter.<br>&nbsp;&nbsp; <br>&nbsp;&nbsp; - get/setrecursionlimit<br>&nbsp;&nbsp; - get/setcheckinterval<br>&nbsp;&nbsp; - _getframe and _current_frame<br>&nbsp;&nbsp; - getrefcount<br>&nbsp;&nbsp; - get/setdlopenflags<br>
&nbsp;&nbsp; - settscdumps<br>&nbsp;&nbsp; - api_version<br>&nbsp;&nbsp; - winver<br>&nbsp;&nbsp; - dllhandle<br>&nbsp;&nbsp; - float_info<br>&nbsp;&nbsp; - _compact_freelists<br>&nbsp;&nbsp; - _clear_type_cache<br>&nbsp;&nbsp; - subversion<br><br>The second collections of items has been steadily increasing over the years<br>
causing clutter in sys.&nbsp; Guido has even said he doesn&#39;t recognize some of things<br>in it [#bug-1522]_!<br><br>Other implementations have clearly struggled with what to do about the contents<br>of sys they can&#39;t implement but must to retain compatibility.&nbsp; For example,<br>
Jython&#39;s sys module has dud set/getrecursionlimit functions.&nbsp; Moving these items<br>items off to another module would send a clear message about what functions need<br>and need not be implemented.<br><br>It has also been proposed that the contents of types module be distributed<br>
across the standard library [#types-removal]_; the interpreter module would<br>provide an excellent resting place for internal types like frames and code<br>objects.<br><br>Specification<br>=============<br><br>A new builtin module named &quot;interpreter&quot; (see `Naming`_) will be added.<br>
<br>The second list of items above will be split into the stdlib as follows:<br><br>The interpreter module<br>&nbsp;&nbsp;&nbsp; - get/setrecursionlimit<br>&nbsp;&nbsp;&nbsp; - get/setcheckinterval<br>&nbsp;&nbsp;&nbsp; - _getframe and _current_frame<br>&nbsp;&nbsp;&nbsp; - get/setdlopenflags<br>
&nbsp;&nbsp;&nbsp; - settscdumps<br>&nbsp;&nbsp;&nbsp; - api_version<br>&nbsp;&nbsp;&nbsp; - winver<br>&nbsp;&nbsp;&nbsp; - dllhandle<br>&nbsp;&nbsp;&nbsp; - float_info<br>&nbsp;&nbsp;&nbsp; - _clear_type_cache<br>&nbsp;&nbsp;&nbsp; - subversion<br><br>The gc module:<br>&nbsp;&nbsp;&nbsp; - getrefcount<br>&nbsp;&nbsp;&nbsp; - _compact_freelists<br><br><br>
Transition Plan<br>===============<br><br>Once implemented in 3.x, the interpreter module will be back-ported to 2.6.<br>Py3k warnings will be added the the sys functions it replaces.<br><br><br>Open Issues<br>===========<br>
<br>What should move?<br>-----------------<br><br>dont_write_bytecode<br>^^^^^^^^^^^^^^^^^^^^<br><br>Some believe that the writing of bytecode is an implementation detail and should<br>be moved [#bytecode-issue]_.&nbsp; The counterargument is that all current, complete<br>
Python implementations do write some sort of bytecode, so it is valuable to be<br>able to disable it.&nbsp; Also, if it is moved, some wish to put it in the imp<br>module.<br><br><br>Naming<br>------<br><br>The author proposes the name &quot;interpreter&quot; for the new module.&nbsp; &quot;pyvm&quot; has also<br>
been suggested [#pyvm-name]_.<br><br><br>References<br>==========<br><br>.. [#bug-1522]<br><br>&nbsp;&nbsp; <a href="http://bugs.python.org/issue1522">http://bugs.python.org/issue1522</a><br><br>.. [#types-removal]<br><br>&nbsp;&nbsp; <a href="http://mail.python.org/pipermail/stdlib-sig/2008-April/000172.html">http://mail.python.org/pipermail/stdlib-sig/2008-April/000172.html</a><br>
<br>.. [#bytecode-issue]<br><br>&nbsp;&nbsp; <a href="http://mail.python.org/pipermail/stdlib-sig/2008-April/000217.html">http://mail.python.org/pipermail/stdlib-sig/2008-April/000217.html</a><br><br>.. [#pyvm-name]<br><br>&nbsp;&nbsp; <a href="http://mail.python.org/pipermail/python-3000/2007-November/011351.html">http://mail.python.org/pipermail/python-3000/2007-November/011351.html</a><br>
<br>Copyright<br>=========<br><br>&nbsp;&nbsp;&nbsp; This document has been placed in the public domain.<br><br><br> <br>Local Variables:<br>mode: indented-text<br>indent-tabs-mode: nil<br>sentence-end-double-space: t<br>fill-column: 70<br>
coding: utf-8<br>End:<br>&nbsp;<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<font color="#888888"><br>
-Brett<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Cheers,<br>Benjamin Peterson