Skip to content
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

Closed
elibendersky mannequin opened this issue Oct 21, 2011 · 15 comments
Closed

Remove <> operator from Grammar/Grammar #57448

elibendersky mannequin opened this issue Oct 21, 2011 · 15 comments
Labels
docs Documentation in the Doc dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@elibendersky
Copy link
Mannequin

elibendersky mannequin commented Oct 21, 2011

BPO 13239
Nosy @freddrake, @warsaw, @brettcannon, @ncoghlan, @pitrou, @benjaminp, @merwok, @florentx
Files
  • issue13239.patch
  • 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:

    assignee = None
    closed_at = <Date 2011-11-13.23:08:23.967>
    created_at = <Date 2011-10-21.09:11:20.365>
    labels = ['interpreter-core', 'type-bug', 'docs']
    title = 'Remove <> operator from Grammar/Grammar'
    updated_at = <Date 2011-11-14.13:23:41.384>
    user = 'https://bugs.python.org/elibendersky'

    bugs.python.org fields:

    activity = <Date 2011-11-14.13:23:41.384>
    actor = 'eric.araujo'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2011-11-13.23:08:23.967>
    closer = 'python-dev'
    components = ['Documentation', 'Interpreter Core']
    creation = <Date 2011-10-21.09:11:20.365>
    creator = 'eli.bendersky'
    dependencies = []
    files = ['23656']
    hgrepos = []
    issue_num = 13239
    keywords = ['patch']
    message_count = 15.0
    messages = ['146070', '146071', '146072', '146110', '146111', '146113', '146116', '146117', '146118', '147424', '147447', '147509', '147519', '147576', '147592']
    nosy_count = 11.0
    nosy_names = ['fdrake', 'barry', 'brett.cannon', 'ncoghlan', 'pitrou', 'benjamin.peterson', 'eric.araujo', 'eli.bendersky', 'flox', 'docs@python', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue13239'
    versions = ['Python 3.2', 'Python 3.3']

    @elibendersky
    Copy link
    Mannequin Author

    elibendersky mannequin commented Oct 21, 2011

    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

    @elibendersky elibendersky mannequin assigned docspython Oct 21, 2011
    @elibendersky elibendersky mannequin added docs Documentation in the Doc dir interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Oct 21, 2011
    @elibendersky
    Copy link
    Mannequin Author

    elibendersky mannequin commented Oct 21, 2011

    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 ?

    @florentx
    Copy link
    Mannequin

    florentx mannequin commented Oct 21, 2011

    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."

    @florentx florentx mannequin added the type-bug An unexpected behavior, bug, or error label Oct 21, 2011
    @brettcannon
    Copy link
    Member

    Probably need a comment in the Grammar file so people know why an
    unused operator is in there.

    @benjaminp
    Copy link
    Contributor

    Or perhaps we don't need joke backward compatibility? (That's nearly 3 years old.)

    @brettcannon
    Copy link
    Member

    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. =)

    @warsaw
    Copy link
    Member

    warsaw commented Oct 21, 2011

    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.

    @pitrou
    Copy link
    Member

    pitrou commented Oct 21, 2011

    OTOH, __future__ imports (even jokes) should never be removed.

    But their meaning can be altered?
    (as part of another joke if you want :)

    @warsaw
    Copy link
    Member

    warsaw commented Oct 21, 2011

    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. :)

    @elibendersky
    Copy link
    Mannequin Author

    elibendersky mannequin commented Nov 11, 2011

    Attaching a patch with a clarifying comment in Grammar/Grammar. Should be enough for now?

    @brettcannon
    Copy link
    Member

    I think the clarification should be enough.

    @merwok
    Copy link
    Member

    merwok commented Nov 12, 2011

    +1 for a comment too. I’d even make it shorter:

    # don't look at <>, it's not a real operator (see PEP-401)

    @elibendersky
    Copy link
    Mannequin Author

    elibendersky mannequin commented Nov 12, 2011

    Éric, do you feel strongly about the wording, or can I just go ahead and commit my version if I like it more :) ?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 13, 2011

    New changeset a259511351d9 by Eli Bendersky in branch '3.2':
    Clarify the existence of the <> operator in Grammar/Grammar with a comment, for bpo-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 bpo-13239
    http://hg.python.org/cpython/rev/410115400838

    @python-dev python-dev mannequin closed this as completed Nov 13, 2011
    @merwok
    Copy link
    Member

    merwok commented Nov 14, 2011

    +# <> 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 :)

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants