@@ -3,7 +3,7 @@ Title: Existence checking operators
3
3
Version: $Revision$
4
4
Last-Modified: $Date$
5
5
Author: Nick Coghlan <ncoghlan@gmail.com>
6
- Status: Draft
6
+ Status: Withdrawn
7
7
Type: Standards Track
8
8
Content-Type: text/x-rst
9
9
Created: 25-Oct-2016
@@ -52,6 +52,53 @@ following characteristics:
52
52
(zeroes, empty containers) will still evaluate to True in an existence
53
53
checking context
54
54
55
+ PEP Withdrawal
56
+ ==============
57
+
58
+ When posting this PEP for discussion on python-ideas [4_], I asked reviewers to
59
+ consider 3 high level design questions before moving on to considering the
60
+ specifics of this particular syntactic proposal:
61
+
62
+ 1. Do we collectively agree that "existence checking" is a useful
63
+ general concept that exists in software development and is distinct
64
+ from the concept of "truth checking"?
65
+ 2. Do we collectively agree that the Python ecosystem would benefit
66
+ from an existence checking protocol that permits generalisation of
67
+ algorithms (especially short circuiting ones) across different "data
68
+ missing" indicators, including those defined in the language
69
+ definition, the standard library, and custom user code?
70
+ 3. Do we collectively agree that it would be easier to use such a
71
+ protocol effectively if existence-checking equivalents to the
72
+ truth-checking "and" and "or" control flow operators were available?
73
+
74
+ While the answers to the first question were generally positive, it quickly
75
+ became clear that the answer to the second question is "No".
76
+
77
+ Steven D'Aprano articulated the counter-argument well in [5_], but the general
78
+ idea is that when checking for "missing data" sentinels, we're almost always
79
+ looking for a *specific* sentinel value, rather than *any* sentinel value.
80
+
81
+ ``NotImplemented`` exists, for example, due to ``None`` being a potentially
82
+ legitimate result from overloaded arithmetic operators and exception
83
+ handling imposing too much runtime overhead to be useful for operand coercion.
84
+
85
+ Similarly, ``Ellipsis`` exists for multi-dimensional slicing support due to
86
+ ``None`` already have another meaning in a slicing context (indicating the use
87
+ of the default start or stop indices, or the default step size).
88
+
89
+ In mathematics, the value of ``NaN`` is that *programmatically* it behaves
90
+ like a normal value of its type (e.g. exposing all the usual attributes and
91
+ methods), while arithmetically it behaves according to the mathematical rules
92
+ for handling ``NaN`` values.
93
+
94
+ With that core design concept invalidated, the proposal as a whole doesn't
95
+ make sense, and it is accordingly withdrawn.
96
+
97
+ However, the discussion of the proposal did prompt consideration of a potential
98
+ protocol based approach to make the existing ``and``, ``or`` and ``if-else``
99
+ operators more flexible [6_] without introducing any new syntax, so I'll be
100
+ writing that up as another possible alternative to PEP 505.
101
+
55
102
56
103
Relationship with other PEPs
57
104
============================
@@ -584,6 +631,14 @@ References
584
631
.. [3] FileFormat.info: Unicode Character 'THERE EXISTS' (U+2203)
585
632
(http://www.fileformat.info/info/unicode/char/2203/index.htm)
586
633
634
+ .. [4] python-ideas discussion thread
635
+ (https://mail.python.org/pipermail/python-ideas/2016-October/043415.html)
636
+
637
+ .. [5] Steven D'Aprano's critique of the proposal
638
+ (https://mail.python.org/pipermail/python-ideas/2016-October/043453.html)
639
+
640
+ .. [6] Considering a link to the idea of overloadable Boolean operators
641
+ (https://mail.python.org/pipermail/python-ideas/2016-October/043447.html)
587
642
588
643
Copyright
589
644
=========
0 commit comments