309 lines
19 KiB
HTML
309 lines
19 KiB
HTML
|
||
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta name="color-scheme" content="light dark">
|
||
<title>PEP 434 – IDLE Enhancement Exception for All Branches | peps.python.org</title>
|
||
<link rel="shortcut icon" href="../_static/py.png">
|
||
<link rel="canonical" href="https://peps.python.org/pep-0434/">
|
||
<link rel="stylesheet" href="../_static/style.css" type="text/css">
|
||
<link rel="stylesheet" href="../_static/mq.css" type="text/css">
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" media="(prefers-color-scheme: light)" id="pyg-light">
|
||
<link rel="stylesheet" href="../_static/pygments_dark.css" type="text/css" media="(prefers-color-scheme: dark)" id="pyg-dark">
|
||
<link rel="alternate" type="application/rss+xml" title="Latest PEPs" href="https://peps.python.org/peps.rss">
|
||
<meta property="og:title" content='PEP 434 – IDLE Enhancement Exception for All Branches | peps.python.org'>
|
||
<meta property="og:description" content="Most CPython tracker issues are classified as behavior or enhancement. Most behavior patches are backported to branches for existing versions. Enhancement patches are restricted to the default branch that becomes the next Python version.">
|
||
<meta property="og:type" content="website">
|
||
<meta property="og:url" content="https://peps.python.org/pep-0434/">
|
||
<meta property="og:site_name" content="Python Enhancement Proposals (PEPs)">
|
||
<meta property="og:image" content="https://peps.python.org/_static/og-image.png">
|
||
<meta property="og:image:alt" content="Python PEPs">
|
||
<meta property="og:image:width" content="200">
|
||
<meta property="og:image:height" content="200">
|
||
<meta name="description" content="Most CPython tracker issues are classified as behavior or enhancement. Most behavior patches are backported to branches for existing versions. Enhancement patches are restricted to the default branch that becomes the next Python version.">
|
||
<meta name="theme-color" content="#3776ab">
|
||
</head>
|
||
<body>
|
||
|
||
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
|
||
<symbol id="svg-sun-half" viewBox="0 0 24 24" pointer-events="all">
|
||
<title>Following system colour scheme</title>
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
|
||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||
<circle cx="12" cy="12" r="9"></circle>
|
||
<path d="M12 3v18m0-12l4.65-4.65M12 14.3l7.37-7.37M12 19.6l8.85-8.85"></path>
|
||
</svg>
|
||
</symbol>
|
||
<symbol id="svg-moon" viewBox="0 0 24 24" pointer-events="all">
|
||
<title>Selected dark colour scheme</title>
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
|
||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z"></path>
|
||
</svg>
|
||
</symbol>
|
||
<symbol id="svg-sun" viewBox="0 0 24 24" pointer-events="all">
|
||
<title>Selected light colour scheme</title>
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
|
||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||
<circle cx="12" cy="12" r="5"></circle>
|
||
<line x1="12" y1="1" x2="12" y2="3"></line>
|
||
<line x1="12" y1="21" x2="12" y2="23"></line>
|
||
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
|
||
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
|
||
<line x1="1" y1="12" x2="3" y2="12"></line>
|
||
<line x1="21" y1="12" x2="23" y2="12"></line>
|
||
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
|
||
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
|
||
</svg>
|
||
</symbol>
|
||
</svg>
|
||
<script>
|
||
|
||
document.documentElement.dataset.colour_scheme = localStorage.getItem("colour_scheme") || "auto"
|
||
</script>
|
||
<section id="pep-page-section">
|
||
<header>
|
||
<h1>Python Enhancement Proposals</h1>
|
||
<ul class="breadcrumbs">
|
||
<li><a href="https://www.python.org/" title="The Python Programming Language">Python</a> » </li>
|
||
<li><a href="../pep-0000/">PEP Index</a> » </li>
|
||
<li>PEP 434</li>
|
||
</ul>
|
||
<button id="colour-scheme-cycler" onClick="setColourScheme(nextColourScheme())">
|
||
<svg aria-hidden="true" class="colour-scheme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
|
||
<svg aria-hidden="true" class="colour-scheme-icon-when-dark"><use href="#svg-moon"></use></svg>
|
||
<svg aria-hidden="true" class="colour-scheme-icon-when-light"><use href="#svg-sun"></use></svg>
|
||
<span class="visually-hidden">Toggle light / dark / auto colour theme</span>
|
||
</button>
|
||
</header>
|
||
<article>
|
||
<section id="pep-content">
|
||
<h1 class="page-title">PEP 434 – IDLE Enhancement Exception for All Branches</h1>
|
||
<dl class="rfc2822 field-list simple">
|
||
<dt class="field-odd">Author<span class="colon">:</span></dt>
|
||
<dd class="field-odd">Todd Rovito <rovitotv at gmail.com>,
|
||
Terry Reedy <tjreedy at udel.edu></dd>
|
||
<dt class="field-even">BDFL-Delegate<span class="colon">:</span></dt>
|
||
<dd class="field-even">Alyssa Coghlan</dd>
|
||
<dt class="field-odd">Status<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><abbr title="Currently valid informational guidance, or an in-use process">Active</abbr></dd>
|
||
<dt class="field-even">Type<span class="colon">:</span></dt>
|
||
<dd class="field-even"><abbr title="Non-normative PEP containing background, guidelines or other information relevant to the Python ecosystem">Informational</abbr></dd>
|
||
<dt class="field-odd">Created<span class="colon">:</span></dt>
|
||
<dd class="field-odd">16-Feb-2013</dd>
|
||
<dt class="field-even">Post-History<span class="colon">:</span></dt>
|
||
<dd class="field-even">16-Feb-2013,
|
||
03-Mar-2013,
|
||
21-Mar-2013,
|
||
30-Mar-2013</dd>
|
||
<dt class="field-odd">Resolution<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><a class="reference external" href="https://mail.python.org/pipermail/python-dev/2013-March/125003.html">Python-Dev message</a></dd>
|
||
</dl>
|
||
<hr class="docutils" />
|
||
<section id="contents">
|
||
<details><summary>Table of Contents</summary><ul class="simple">
|
||
<li><a class="reference internal" href="#abstract">Abstract</a></li>
|
||
<li><a class="reference internal" href="#motivation">Motivation</a></li>
|
||
<li><a class="reference internal" href="#rationale">Rationale</a></li>
|
||
<li><a class="reference internal" href="#backwards-compatibility">Backwards Compatibility</a></li>
|
||
<li><a class="reference internal" href="#references">References</a></li>
|
||
<li><a class="reference internal" href="#copyright">Copyright</a></li>
|
||
</ul>
|
||
</details></section>
|
||
<section id="abstract">
|
||
<h2><a class="toc-backref" href="#abstract" role="doc-backlink">Abstract</a></h2>
|
||
<p>Most CPython tracker issues are classified as behavior or enhancement.
|
||
Most behavior patches are backported to branches for existing
|
||
versions. Enhancement patches are restricted to the default branch
|
||
that becomes the next Python version.</p>
|
||
<p>This PEP proposes that the restriction on applying enhancements be
|
||
relaxed for IDLE code, residing in …/Lib/idlelib/. In practice,
|
||
this would mean that IDLE developers would not have to classify or
|
||
agree on the classification of a patch but could instead focus on what
|
||
is best for IDLE users and future IDLE development. It would also
|
||
mean that IDLE patches would not necessarily have to be split into
|
||
‘bugfix’ changes and enhancement changes.</p>
|
||
<p>The PEP would apply to changes in existing features and addition of
|
||
small features, such as would require a new menu entry, but not
|
||
necessarily to possible major re-writes such as switching to themed
|
||
widgets or tabbed windows.</p>
|
||
</section>
|
||
<section id="motivation">
|
||
<h2><a class="toc-backref" href="#motivation" role="doc-backlink">Motivation</a></h2>
|
||
<p>This PEP was prompted by controversy on both the tracker and pydev
|
||
list over adding Cut, Copy, and Paste to right-click context menus
|
||
(Issue 1207589, opened in 2005 <a class="footnote-reference brackets" href="#id8" id="id1">[1]</a>; pydev thread <a class="footnote-reference brackets" href="#id9" id="id2">[2]</a>). The features
|
||
were available as keyboard shortcuts but not on the context menu. It
|
||
is standard, at least on Windows, that they should be when applicable
|
||
(a read-only window would only have Copy), so users do not have to
|
||
shift to the keyboard after selecting text for cutting or copying or a
|
||
slice point for pasting. The context menu was not documented until 10
|
||
days before the new options were added (Issue 10405 <a class="footnote-reference brackets" href="#id12" id="id3">[5]</a>).</p>
|
||
<p>Normally, behavior is called a bug if it conflicts with documentation
|
||
judged to be correct. But if there is no doc, what is the standard?
|
||
If the code is its own documentation, most IDLE issues on the tracker
|
||
are enhancement issues. If we substitute reasonable user expectation,
|
||
(which can, of course, be its own subject of disagreement), many more
|
||
issues are behavior issues.</p>
|
||
<p>For context menus, people disagreed on the status of the additions –
|
||
bugfix or enhancement. Even people who called it an enhancement
|
||
disagreed as to whether the patch should be backported. This PEP
|
||
proposes to make the status disagreement irrelevant by explicitly
|
||
allowing more liberal backporting than for other stdlib modules.</p>
|
||
<p>Python does have many advanced features yet Python is well known for
|
||
being an easy computer language for beginners <a class="footnote-reference brackets" href="#id10" id="id4">[3]</a>. A major Python
|
||
philosophy is “batteries included” which is best demonstrated in
|
||
Python’s standard library with many modules that are not typically
|
||
included with other programming languages <a class="footnote-reference brackets" href="#id11" id="id5">[4]</a>. IDLE is an important
|
||
“battery” in the Python toolbox because it allows a beginner to get
|
||
started quickly without downloading and configuring a third party IDE.
|
||
IDLE represents a commitment by the Python community to encouage the
|
||
use of Python as a teaching language both inside and outside of formal
|
||
educational settings. The recommended teaching experience is to have
|
||
a learner start with IDLE. This PEP and the work that it will enable
|
||
will allow the Python community to make that learner’s experience with
|
||
IDLE awesome by making IDLE a simple tool for beginners to get started
|
||
with Python.</p>
|
||
</section>
|
||
<section id="rationale">
|
||
<h2><a class="toc-backref" href="#rationale" role="doc-backlink">Rationale</a></h2>
|
||
<p>People primarily use IDLE by running the graphical user interface
|
||
(GUI) application, rather than by directly importing the effectively
|
||
private (undocumented) implementation modules in idlelib. Whether
|
||
they use the shell, the editor, or both, we believe they will benefit
|
||
more from consistency across the latest releases of current Python
|
||
versions than from consistency within the bugfix releases for one
|
||
Python version. This is especially true when existing behavior is
|
||
clearly unsatisfactory.</p>
|
||
<p>When people use the standard interpreter, the OS-provided frame works
|
||
the same for all Python versions. If, for instance, Microsoft were to
|
||
upgrade the Command Prompt GUI, the improvements would be present
|
||
regardless of which Python were running within it. Similarly, if one
|
||
edits Python code with editor X, behaviors such as the right-click
|
||
context menu and the search-replace box do not depend on the version
|
||
of Python being edited or even the language being edited.</p>
|
||
<p>The benefit for IDLE developers is mixed. On the one hand, testing
|
||
more versions and possibly having to adjust a patch, especially for
|
||
2.7, is more work. (There is, of course, the option on not
|
||
backporting everything. For issue 12510, some changes to calltips for
|
||
classes were not included in the 2.7 patch because of issues with
|
||
old-style classes <a class="footnote-reference brackets" href="#id13" id="id6">[6]</a>.) On the other hand, bike-shedding can be an
|
||
energy drain. If the obvious fix for a bug looks like an enhancement,
|
||
writing a separate bugfix-only patch is more work. And making the
|
||
code diverge between versions makes future multi-version patches more
|
||
difficult.</p>
|
||
<p>These issue are illustrated by the search-and-replace dialog box. It
|
||
used to raise an exception for certain user entries <a class="footnote-reference brackets" href="#id14" id="id7">[7]</a>. The
|
||
uncaught exception caused IDLE to exit. At least on Windows, the exit
|
||
was silent (no visible traceback) and looked like a crash if IDLE was
|
||
started normally, from an icon.</p>
|
||
<p>Was this a bug? IDLE Help (on the current Help submenu) just says
|
||
“Replace… Open a search-and-replace dialog box”, and a box <em>was</em>
|
||
opened. It is not, in general, a bug for a library method to raise an
|
||
exception. And it is not, in general, a bug for a library method to
|
||
ignore an exception raised by functions it calls. So if we were to
|
||
adopt the ‘code = doc’ philosophy in the absence of detailed docs, one
|
||
might say ‘No’.</p>
|
||
<p>However, IDLE exiting when it does not need to is definitely
|
||
obnoxious. So four of us agreed that it should be prevented. But
|
||
there was still the question of what to do instead? Catch the
|
||
exception? Just not raise the exception? Beep? Display an error
|
||
message box? Or try to do something useful with the user’s entry?
|
||
Would replacing a ‘crash’ with useful behavior be an enhancement,
|
||
limited to future Python releases? Should IDLE developers have to ask
|
||
that?</p>
|
||
</section>
|
||
<section id="backwards-compatibility">
|
||
<h2><a class="toc-backref" href="#backwards-compatibility" role="doc-backlink">Backwards Compatibility</a></h2>
|
||
<p>For IDLE, there are three types of users who might be concerned about
|
||
back compatibility. First are people who run IDLE as an application.
|
||
We have already discussed them above.</p>
|
||
<p>Second are people who import one of the idlelib modules. As far as we
|
||
know, this is only done to start the IDLE application, and we do not
|
||
propose breaking such use. Otherwise, the modules are undocumented
|
||
and effectively private implementations. If an IDLE module were
|
||
defined as public, documented, and perhaps moved to the tkinter
|
||
package, it would then follow the normal rules. (Documenting the
|
||
private interfaces for the benefit of people working on the IDLE code
|
||
is a separate issue.)</p>
|
||
<p>Third are people who write IDLE extensions. The guaranteed extension
|
||
interface is given in idlelib/extension.txt. This should be respected
|
||
at least in existing versions, and not frivolously changed in future
|
||
versions. But there is a warning that “The extension cannot assume
|
||
much about this [EditorWindow] argument.” This guarantee should
|
||
rarely be an issue with patches, and the issue is not specific to
|
||
‘enhancement’ versus ‘bugfix’ patches.</p>
|
||
<p>As is happens, after the context menu patch was applied, it came up
|
||
that extensions that added items to the context menu (rare) would be
|
||
broken because the patch a) added a new item to standard rmenu_specs
|
||
and b) expected every rmenu_spec to be lengthened. It is not clear
|
||
whether this violates the guarantee, but there is a second patch that
|
||
fixes assumption b). It should be applied when it is clear that the
|
||
first patch will not have to be reverted.</p>
|
||
</section>
|
||
<section id="references">
|
||
<h2><a class="toc-backref" href="#references" role="doc-backlink">References</a></h2>
|
||
<aside class="footnote-list brackets">
|
||
<aside class="footnote brackets" id="id8" role="doc-footnote">
|
||
<dt class="label" id="id8">[<a href="#id1">1</a>]</dt>
|
||
<dd>IDLE: Right Click Context Menu, Foord, Michael
|
||
(<a class="reference external" href="http://bugs.python.org/issue1207589">http://bugs.python.org/issue1207589</a>)</aside>
|
||
<aside class="footnote brackets" id="id9" role="doc-footnote">
|
||
<dt class="label" id="id9">[<a href="#id2">2</a>]</dt>
|
||
<dd>Cut/Copy/Paste items in IDLE right click context menu
|
||
(<a class="reference external" href="https://mail.python.org/pipermail/python-dev/2012-November/122514.html">https://mail.python.org/pipermail/python-dev/2012-November/122514.html</a>)</aside>
|
||
<aside class="footnote brackets" id="id10" role="doc-footnote">
|
||
<dt class="label" id="id10">[<a href="#id4">3</a>]</dt>
|
||
<dd>Getting Started with Python
|
||
(<a class="reference external" href="http://www.python.org/about/gettingstarted/">http://www.python.org/about/gettingstarted/</a>)</aside>
|
||
<aside class="footnote brackets" id="id11" role="doc-footnote">
|
||
<dt class="label" id="id11">[<a href="#id5">4</a>]</dt>
|
||
<dd>Batteries Included
|
||
(<a class="reference external" href="http://docs.python.org/2/tutorial/stdlib.html#batteries-included">http://docs.python.org/2/tutorial/stdlib.html#batteries-included</a>)</aside>
|
||
<aside class="footnote brackets" id="id12" role="doc-footnote">
|
||
<dt class="label" id="id12">[<a href="#id3">5</a>]</dt>
|
||
<dd>IDLE breakpoint facility undocumented, Deily, Ned
|
||
(<a class="reference external" href="http://bugs.python.org/issue10405">http://bugs.python.org/issue10405</a>)</aside>
|
||
<aside class="footnote brackets" id="id13" role="doc-footnote">
|
||
<dt class="label" id="id13">[<a href="#id6">6</a>]</dt>
|
||
<dd>IDLE: calltips mishandle raw strings and other examples,
|
||
Reedy, Terry (<a class="reference external" href="http://bugs.python.org/issue12510">http://bugs.python.org/issue12510</a>)</aside>
|
||
<aside class="footnote brackets" id="id14" role="doc-footnote">
|
||
<dt class="label" id="id14">[<a href="#id7">7</a>]</dt>
|
||
<dd>IDLE: replace ending with ‘' causes crash, Reedy, Terry
|
||
(<a class="reference external" href="http://bugs.python.org/issue13052">http://bugs.python.org/issue13052</a>)</aside>
|
||
</aside>
|
||
</section>
|
||
<section id="copyright">
|
||
<h2><a class="toc-backref" href="#copyright" role="doc-backlink">Copyright</a></h2>
|
||
<p>This document has been placed in the public domain.</p>
|
||
</section>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<p>Source: <a class="reference external" href="https://github.com/python/peps/blob/main/peps/pep-0434.rst">https://github.com/python/peps/blob/main/peps/pep-0434.rst</a></p>
|
||
<p>Last modified: <a class="reference external" href="https://github.com/python/peps/commits/main/peps/pep-0434.rst">2023-10-11 12:05:51 GMT</a></p>
|
||
|
||
</article>
|
||
<nav id="pep-sidebar">
|
||
<h2>Contents</h2>
|
||
<ul>
|
||
<li><a class="reference internal" href="#abstract">Abstract</a></li>
|
||
<li><a class="reference internal" href="#motivation">Motivation</a></li>
|
||
<li><a class="reference internal" href="#rationale">Rationale</a></li>
|
||
<li><a class="reference internal" href="#backwards-compatibility">Backwards Compatibility</a></li>
|
||
<li><a class="reference internal" href="#references">References</a></li>
|
||
<li><a class="reference internal" href="#copyright">Copyright</a></li>
|
||
</ul>
|
||
|
||
<br>
|
||
<a id="source" href="https://github.com/python/peps/blob/main/peps/pep-0434.rst">Page Source (GitHub)</a>
|
||
</nav>
|
||
</section>
|
||
<script src="../_static/colour_scheme.js"></script>
|
||
<script src="../_static/wrap_tables.js"></script>
|
||
<script src="../_static/sticky_banner.js"></script>
|
||
</body>
|
||
</html> |