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

Discourage operator.__dunder__ functions #74271

Closed
stevendaprano opened this issue Apr 17, 2017 · 7 comments
Closed

Discourage operator.__dunder__ functions #74271

stevendaprano opened this issue Apr 17, 2017 · 7 comments
Assignees
Labels
3.7 (EOL) end of life docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@stevendaprano
Copy link
Member

BPO 30085
Nosy @rhettinger, @terryjreedy, @ncoghlan, @stevendaprano, @SanketDG
PRs
  • bpo-30085: Improve documentation for operator #1171
  • [3.6] bpo-30085: Improve documentation for operator (GH-1171) #3736
  • 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 = 'https://github.com/terryjreedy'
    closed_at = <Date 2017-09-24.18:30:04.724>
    created_at = <Date 2017-04-17.02:27:09.573>
    labels = ['type-feature', '3.7', 'docs']
    title = 'Discourage operator.__dunder__ functions'
    updated_at = <Date 2017-09-24.21:13:17.867>
    user = 'https://github.com/stevendaprano'

    bugs.python.org fields:

    activity = <Date 2017-09-24.21:13:17.867>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2017-09-24.18:30:04.724>
    closer = 'terry.reedy'
    components = ['Documentation']
    creation = <Date 2017-04-17.02:27:09.573>
    creator = 'steven.daprano'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30085
    keywords = []
    message_count = 7.0
    messages = ['291774', '291991', '291993', '292062', '302220', '302878', '302886']
    nosy_count = 6.0
    nosy_names = ['rhettinger', 'terry.reedy', 'ncoghlan', 'steven.daprano', 'docs@python', 'sanketdg']
    pr_nums = ['1171', '3736']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue30085'
    versions = ['Python 3.7']

    @stevendaprano
    Copy link
    Member Author

    As discussed on the Python-Ideas mailing list, it is time to discourage the use of operator.__dunder__ functions. Not to remove them or deprecate them, just change the documentation to make it clear that the dunderless versions are preferred.

    Guido +1'ed this suggestion, and there were no objections:

    https://mail.python.org/pipermail/python-ideas/2017-April/045424.html

    @stevendaprano stevendaprano added the docs Documentation in the Doc dir label Apr 17, 2017
    @terryjreedy
    Copy link
    Member

    My suggestion from the python-ideas thread:: replace the current

    "The function names are those used for special class methods; variants without leading and trailing __ are also provided for convenience."

    with

    ""Many function names are those used for special methods, minus the double underscores. For backward compatibility, many of these have a variant with the double underscores kept. We recommend using the dunderless form. Note that operator.__add__(x, y), for instance, being the same as x + y, is not the same as x.__add__(y)."

    Possibly add ", since the first two may result in calling y.__radd__(x)".

    Raymond assigned the

    @terryjreedy terryjreedy assigned rhettinger and unassigned docspython Apr 20, 2017
    @terryjreedy
    Copy link
    Member

    Raymond assigned the PR to himself, so I added him here as nosy and assignee.

    @SanketDG
    Copy link
    Mannequin

    SanketDG mannequin commented Apr 21, 2017

    @terry, I have updated the same, thanks!

    @terryjreedy terryjreedy added 3.7 (EOL) end of life type-feature A feature request or enhancement labels May 4, 2017
    @terryjreedy
    Copy link
    Member

    Raymond, may someone else merge this? I will add a blurb.

    @terryjreedy
    Copy link
    Member

    New changeset 5b9299d by Terry Jan Reedy (Sanket Dasgupta) in branch 'master':
    bpo-30085: Improve documentation for operator (bpo-1171)
    5b9299d

    @terryjreedy
    Copy link
    Member

    New changeset d38caf6 by Terry Jan Reedy (Miss Islington (bot)) in branch '3.6':
    [3.6] bpo-30085: Improve documentation for operator (GH-1171) (bpo-3736)
    d38caf6

    @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
    3.7 (EOL) end of life docs Documentation in the Doc dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants