New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove <> operator from Grammar/Grammar #57448
Comments
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 |
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 ? |
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." |
Probably need a comment in the Grammar file so people know why an |
Or perhaps we don't need joke backward compatibility? (That's nearly 3 years old.) |
On Fri, Oct 21, 2011 at 11:35, Benjamin Peterson <report@bugs.python.org> wrote:
Then you tell the FLUFL that you want to take his precious operator away. =) |
On Oct 21, 2011, at 06:35 PM, Benjamin Peterson wrote:
OTOH, __future__ imports (even jokes) should never be removed. |
But their meaning can be altered? |
On Oct 21, 2011, at 07:33 PM, Antoine Pitrou wrote:
Well, you have 6 months to work that out then. :) |
Attaching a patch with a clarifying comment in Grammar/Grammar. Should be enough for now? |
I think the clarification should be enough. |
+1 for a comment too. I’d even make it shorter: # don't look at <>, it's not a real operator (see PEP-401) |
Éric, do you feel strongly about the wording, or can I just go ahead and commit my version if I like it more :) ? |
New changeset a259511351d9 by Eli Bendersky in branch '3.2': New changeset 410115400838 by Eli Bendersky in branch 'default': |
+# <> isn't actually a valid comparison operator in Python. It's here for the 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 :) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: