CINXE.COM

[Python-3000] PEP: Cleaning out sys and the "interpreter" module

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <TITLE> [Python-3000] PEP: Cleaning out sys and the &quot;interpreter&quot; module </TITLE> <LINK REL="Index" HREF="index.html" > <LINK REL="made" HREF="mailto:python-3000%40python.org?Subject=Re%3A%20%5BPython-3000%5D%20PEP%3A%20Cleaning%20out%20sys%20and%20the%20%22interpreter%22%20module&In-Reply-To=%3C1afaf6160804071410s101c16a9pb6cbf5493300cc4e%40mail.gmail.com%3E"> <META NAME="robots" CONTENT="index,nofollow"> <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> <LINK REL="Previous" HREF="012974.html"> <LINK REL="Next" HREF="012978.html"> </HEAD> <BODY BGCOLOR="#ffffff"> <H1>[Python-3000] PEP: Cleaning out sys and the &quot;interpreter&quot; module</H1> <B>Benjamin Peterson</B> <A HREF="mailto:python-3000%40python.org?Subject=Re%3A%20%5BPython-3000%5D%20PEP%3A%20Cleaning%20out%20sys%20and%20the%20%22interpreter%22%20module&In-Reply-To=%3C1afaf6160804071410s101c16a9pb6cbf5493300cc4e%40mail.gmail.com%3E" TITLE="[Python-3000] PEP: Cleaning out sys and the &quot;interpreter&quot; module">musiccomposition at gmail.com </A><BR> <I>Mon Apr 7 23:10:01 CEST 2008</I> <P><UL> <LI>Previous message: <A HREF="012974.html">[Python-3000] r62195 - in python/trunk: Doc/c-api/file.rst Include/fileobject.h Lib/test/test_file.py Misc/NEWS Objects/fileobject.c </A></li> <LI>Next message: <A HREF="012978.html">[Python-3000] PEP: Cleaning out sys and the &quot;interpreter&quot; module </A></li> <LI> <B>Messages sorted by:</B> <a href="date.html#12977">[ date ]</a> <a href="thread.html#12977">[ thread ]</a> <a href="subject.html#12977">[ subject ]</a> <a href="author.html#12977">[ author ]</a> </LI> </UL> <HR> <!--beginarticle--> <PRE>After a long conversation on the stdlib-sig list, I'd like to bring this before you. For those of you not on the peps mailing list, Guido has expressed lukewarmness (well -0.5) to the idea. However, I'd still like your comments on my first PEP. PEP: XXX Title: Cleaning out sys and the &quot;interpreter&quot; 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 Abstract ======== 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. Rationale ========= The sys module currently contains functions and data that can be put into two major groups: 1. Data and functions that are available in all Python implementations and deal with the general running of a Python virtual machine. - argv - byteorder - path, path_hooks, meta_path, path_importer_cache, and modules - copyright, hexversion, version, and version_info - displayhook, __displayhook__ - excepthook, __excepthook__, exc_info, and exc_clear - exec_prefix and prefix - executable - exit - flags, py3kwarning, dont_write_bytecode, and warn_options - getfilesystemencoding - get/setprofile - get/settrace, call_tracing - getwindowsversion - maxint and maxunicode - platform - ps1 and ps2 - stdin, stderr, stdout, __stdin__, __stderr__, __stdout__ - tracebacklimit 2. Data and functions that affect the CPython interpreter. - get/setrecursionlimit - get/setcheckinterval - _getframe and _current_frame - getrefcount - get/setdlopenflags - settscdumps - api_version - winver - dllhandle - float_info - _compact_freelists - _clear_type_cache - subversion - builtin_module_names - callstats - intern 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 things in it [#bug-1522]_! Other implementations have clearly struggled with what to do about the contents 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 items off to another module would send a clear message about what functions need 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 objects. Specification ============= A new builtin module named &quot;interpreter&quot; (see `Naming`_) will be added. The second list of items above will be split into the stdlib as follows: The interpreter module - get/setrecursionlimit - get/setcheckinterval - _getframe and _current_frame - get/setdlopenflags - settscdumps - api_version - winver - dllhandle - float_info - _clear_type_cache - subversion - builtin_module_names - callstats - intern The gc module: - getrefcount - _compact_freelists 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 =========== What should move? ----------------- dont_write_bytecode ^^^^^^^^^^^^^^^^^^^^ Some believe that the writing of bytecode is an implementation detail and should be moved [#bytecode-issue]_. The counterargument is that all current, complete Python implementations do write some sort of bytecode, so it is valuable to be able to disable it. Also, if it is moved, some wish to put it in the imp module. Move to some to imp? -------------------- It was noted that dont_write_bytecode or maybe builtin_module_names might fit nicely in the imp module. Naming ------ The author proposes the name &quot;interpreter&quot; for the new module. &quot;pyvm&quot; has also been suggested [#pyvm-name]_. The name &quot;cpython&quot; was well liked [#cpython-name]_. References ========== .. [#bug-1522] <A HREF="http://bugs.python.org/issue1522">http://bugs.python.org/issue1522</A> .. [#types-removal] <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> .. [#bytecode-issue] <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> .. [#pyvm-name] <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> .. [#cpython-name] <A HREF="http://mail.python.org/pipermail/stdlib-sig/2008-April/000223.html">http://mail.python.org/pipermail/stdlib-sig/2008-April/000223.html</A> Copyright ========= 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 End: -- Cheers, Benjamin Peterson -------------- next part -------------- An HTML attachment was scrubbed... URL: <A HREF="http://mail.python.org/pipermail/python-3000/attachments/20080407/05225735/attachment-0001.htm">http://mail.python.org/pipermail/python-3000/attachments/20080407/05225735/attachment-0001.htm</A> </PRE> <!--endarticle--> <HR> <P><UL> <!--threads--> <LI>Previous message: <A HREF="012974.html">[Python-3000] r62195 - in python/trunk: Doc/c-api/file.rst Include/fileobject.h Lib/test/test_file.py Misc/NEWS Objects/fileobject.c </A></li> <LI>Next message: <A HREF="012978.html">[Python-3000] PEP: Cleaning out sys and the &quot;interpreter&quot; module </A></li> <LI> <B>Messages sorted by:</B> <a href="date.html#12977">[ date ]</a> <a href="thread.html#12977">[ thread ]</a> <a href="subject.html#12977">[ subject ]</a> <a href="author.html#12977">[ author ]</a> </LI> </UL> <hr> <a href="http://mail.python.org/mailman/listinfo/python-3000">More information about the Python-3000 mailing list</a><br> </body></html>

Pages: 1 2 3 4 5 6 7 8 9 10