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

An unclear definition in Doc/glossary.rst #88817

Closed
StevenHsuYL mannequin opened this issue Jul 16, 2021 · 9 comments
Closed

An unclear definition in Doc/glossary.rst #88817

StevenHsuYL mannequin opened this issue Jul 16, 2021 · 9 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@StevenHsuYL
Copy link
Mannequin

StevenHsuYL mannequin commented Jul 16, 2021

BPO 44651
Nosy @terryjreedy, @mdickinson, @jdevries3133, @StevenHsuYL
PRs
  • bpo-44651: delete entry of "coercion" in Doc/glossary.rst #27226
  • 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 2021-07-22.16:29:31.507>
    created_at = <Date 2021-07-16.05:11:26.422>
    labels = ['3.11', 'type-feature', '3.9', '3.10', 'docs']
    title = 'An unclear definition in Doc/glossary.rst'
    updated_at = <Date 2021-07-22.16:29:31.507>
    user = 'https://github.com/StevenHsuYL'

    bugs.python.org fields:

    activity = <Date 2021-07-22.16:29:31.507>
    actor = 'mark.dickinson'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2021-07-22.16:29:31.507>
    closer = 'mark.dickinson'
    components = ['Documentation']
    creation = <Date 2021-07-16.05:11:26.422>
    creator = 'StevenHsuYL'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44651
    keywords = ['patch']
    message_count = 9.0
    messages = ['397597', '397645', '397646', '397689', '397700', '397739', '397751', '397983', '397987']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'mark.dickinson', 'docs@python', 'jack__d', 'StevenHsuYL']
    pr_nums = ['27226']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44651'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @StevenHsuYL
    Copy link
    Mannequin Author

    StevenHsuYL mannequin commented Jul 16, 2021

    In Doc/glossary.rst, the definition about "coercion" is as below:

    "The implicit conversion of an instance of one type to another during an operation which involves two arguments of the same type."

    However, in the example following this definition, it shows the arguments of "different" type in an adding operation, and one of them was converted to float for the operation.

    Therefore, we should fix the definition of the coercion to as below:

    "The implicit conversion of an instance of one type to another during an operation which involves two arguments of the different type."

    Or am I realize this sentence wrong?
    Thanks for review.

    https://github.com/python/cpython/blob/main/Doc/glossary.rst

    @StevenHsuYL StevenHsuYL mannequin added 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels Jul 16, 2021
    @StevenHsuYL StevenHsuYL mannequin assigned docspython Jul 16, 2021
    @StevenHsuYL StevenHsuYL mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels Jul 16, 2021
    @StevenHsuYL StevenHsuYL mannequin assigned docspython Jul 16, 2021
    @StevenHsuYL StevenHsuYL mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Jul 16, 2021
    @mdickinson
    Copy link
    Member

    Agreed that "of the same type" part is confusing. I suspect the intended meaning was that the operation *expects* both arguments to have the same type, so if the actual arguments have different types then they have to be coerced to a common type. In the example you mention, the 3 is converted to 3.0 so that the actual addition is applied to two arguments of the same type. So I think the "same type" part *was* intentional, if confusing.

    But coercion was more of a real thing in Python 2, where there was a __coerce__ special method and a coerce builtin function. It isn't really a thing any more in Python 3, except inasmuch as it means "implicit type conversion". And I can't find any uses of :term:`coercion` elsewhere in the docs. Maybe we should just delete this glossary entry?

    If all we mean by coercion is implicit type conversion, then the "operation which involves two arguments" part already seems over-specific: math.sqrt implicitly converts its argument to a float, for example.

    @mdickinson
    Copy link
    Member

    Searching further, none of the uses of "coerce" or "coercion" in the docs seem to be a good match for the definition in this glossary entry. For example, from ipaddress.rst:

    By default, attempting to create a network object with host bits set will
    result in :exc:`ValueError` being raised. To request that the
    additional bits instead be coerced to zero, the flag ``strict=False`` can
    be passed to the constructor

    and from configparser.rst:

    A convenience method which coerces the *option* in the specified *section* to an integer.

    etc. I think we should just get rid of the glossary entry.

    @terryjreedy
    Copy link
    Member

    OK with me.

    @StevenHsuYL
    Copy link
    Mannequin Author

    StevenHsuYL mannequin commented Jul 17, 2021

    Thanks for your reply and suggestion.

    I can totally understand your explanation about the definition of coercion.

    In conclusion, I think this glossary entry may need some modification for better understanding, or simply be deleted.

    So what's the next step?
    Should I create a PR in GitHub?

    Thanks for reply again.

    @jdevries3133
    Copy link
    Mannequin

    jdevries3133 mannequin commented Jul 18, 2021

    @StevenHsuYL yes, you can go ahead and create a PR for this if you'd like! Just follow the directions in the dev guide (link in sidebar).

    I can't really tell for sure because I'm on my phone right now, but it looks like this might be your first time contributing to cpython; welcome! If you have any questions about the process, feel free to put them here.

    @mdickinson
    Copy link
    Member

    My one worry with removing the entry is that documentation of other projects may be referring to it via intersphinx. If we think this is likely to be a real problem, we could leave a stub entry, but I think it's okay to go ahead and delete. To be on the safe side, I would suggest that only make the change for Python 3.11, though, and we don't backport the change to earlier versions of Python.

    @mdickinson
    Copy link
    Member

    New changeset c05a790 by Steven Hsu in branch 'main':
    bpo-44651: delete entry of "coercion" in Doc/glossary.rst (GH-27226)
    c05a790

    @mdickinson
    Copy link
    Member

    Closing. @StevenHsuYL: Thank you for the contribution!

    @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.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants