classification
Title: Remove <> operator from Grammar/Grammar
Type: behavior Stage: resolved
Components: Documentation, Interpreter Core Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: barry, benjamin.peterson, brett.cannon, docs@python, eli.bendersky, eric.araujo, fdrake, flox, ncoghlan, pitrou, python-dev
Priority: normal Keywords: patch

Created on 2011-10-21 09:11 by eli.bendersky, last changed 2011-11-14 13:23 by eric.araujo. This issue is now closed.

Files
File name Uploaded Description Edit
issue13239.patch eli.bendersky, 2011-11-11 08:58 review
Messages (15)
msg146070 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-10-21 09:11
Operator <> was removed in Python 3, but still appears in Grammar/Grammar (and hence in Doc/reference/grammar.rst)

Reported by Alexander Ivanyuta on the docs mailing list
msg146071 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-10-21 09:20
The relevant code in Parser/parsetok.c is:

#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
        if (type == NOTEQUAL) {
            if (!(ps->p_flags & CO_FUTURE_BARRY_AS_BDFL) &&
                            strcmp(str, "!=")) {
                err_ret->error = E_SYNTAX;
                break;
            }
            else if ((ps->p_flags & CO_FUTURE_BARRY_AS_BDFL) &&
                            strcmp(str, "<>")) {
                err_ret->text = "with Barry as BDFL, use '<>' "
                                "instead of '!='";
                err_ret->error = E_SYNTAX;
                break;
            }
        }
#endif


Hmm... I'm too new to remember this joke, but here it presents a practical problem - since Grammar/Grammar is being directly reflected into the documentation (.. literalinclude:: ../../Grammar/Grammar) and thus can confuse.

Is it safe to just remove the whole thing from Grammar/Grammar and correspondingly Parser/parsetok.c ?
msg146072 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2011-10-21 09:28
This is PEP 401.

"[Because] the != inequality operator ... was a horrible, finger pain inducing mistake, the FLUFL reinstates the <> diamond operator as the sole spelling. This change is important enough to be implemented for, and released in Python 3.1. To help transition to this feature, a new future statement, from __future__ import barry_as_FLUFL has been added."
msg146110 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2011-10-21 18:34
Probably need a comment in the Grammar file so people know why an
unused operator is in there.
msg146111 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-10-21 18:35
Or perhaps we don't need joke backward compatibility? (That's nearly 3 years old.)
msg146113 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2011-10-21 18:42
On Fri, Oct 21, 2011 at 11:35, Benjamin Peterson <report@bugs.python.org> wrote:
>
> Benjamin Peterson <benjamin@python.org> added the comment:
>
> Or perhaps we don't need joke backward compatibility? (That's nearly 3 years old.)

Then you tell the FLUFL that you want to take his precious operator away. =)
msg146116 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2011-10-21 19:30
On Oct 21, 2011, at 06:35 PM, Benjamin Peterson wrote:

>Benjamin Peterson <benjamin@python.org> added the comment:
>
>Or perhaps we don't need joke backward compatibility? (That's nearly 3 years
>old.)

OTOH, __future__ imports (even jokes) should never be removed.
msg146117 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-21 19:33
> OTOH, __future__ imports (even jokes) should never be removed.

But their meaning can be altered?
(as part of another joke if you want :)
msg146118 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2011-10-21 19:35
On Oct 21, 2011, at 07:33 PM, Antoine Pitrou wrote:

>Antoine Pitrou <pitrou@free.fr> added the comment:
>
>> OTOH, __future__ imports (even jokes) should never be removed.
>
>But their meaning can be altered?
>(as part of another joke if you want :)

Well, you have 6 months to work that out then. :)
msg147424 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-11-11 08:58
Attaching a patch with a clarifying comment in Grammar/Grammar. Should be enough for now?
msg147447 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2011-11-11 22:04
I think the clarification should be enough.
msg147509 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-12 16:32
+1 for a comment too.  I’d even make it shorter:

# don't look at <>, it's not a real operator (see PEP 401)
msg147519 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-11-12 18:44
Éric, do you feel strongly about the wording, or can I just go ahead and commit my version if I like it more :) ?
msg147576 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-11-13 23:08
New changeset a259511351d9 by Eli Bendersky in branch '3.2':
Clarify the existence of the <> operator in Grammar/Grammar with a comment, for issue 13239
http://hg.python.org/cpython/rev/a259511351d9

New changeset 410115400838 by Eli Bendersky in branch 'default':
Clarify the existence of the <> operator in Grammar/Grammar with a comment. Closes issue 13239
http://hg.python.org/cpython/rev/410115400838
msg147592 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-14 13:23
+# <> isn't actually a valid comparison operator in Python. It's here for the
+# sake of a __future__ import described in PEP 401

If we wanted to be exact, the operator isn’t here for a __future__ import but for a feature enabled by a __future__ import.  But I don’t feel strongly about this at all :)
History
Date User Action Args
2011-11-14 13:23:41eric.araujosetmessages: + msg147592
2011-11-13 23:08:23python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg147576

resolution: fixed
stage: resolved
2011-11-12 18:44:23eli.benderskysetmessages: + msg147519
2011-11-12 16:32:52eric.araujosetmessages: + msg147509
2011-11-11 22:04:20brett.cannonsetmessages: + msg147447
2011-11-11 08:58:48eli.benderskysetfiles: + issue13239.patch
keywords: + patch
messages: + msg147424
2011-10-21 21:47:03eric.araujosetnosy: + eric.araujo
2011-10-21 19:35:11barrysetmessages: + msg146118
2011-10-21 19:33:03pitrousetnosy: + pitrou
messages: + msg146117
2011-10-21 19:30:20barrysetmessages: + msg146116
2011-10-21 18:43:00brett.cannonsetmessages: + msg146113
2011-10-21 18:35:49benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg146111
2011-10-21 18:34:46brett.cannonsetmessages: + msg146110
2011-10-21 09:28:24floxsettype: behavior

messages: + msg146072
nosy: + flox
2011-10-21 09:23:26eli.benderskysetnosy: + fdrake, barry, brett.cannon, ncoghlan
2011-10-21 09:20:21eli.benderskysetmessages: + msg146071
2011-10-21 09:11:20eli.benderskycreate