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

Unify arguments names in Unicode object C API documentation #62897

Closed
serhiy-storchaka opened this issue Aug 9, 2013 · 9 comments
Closed

Unify arguments names in Unicode object C API documentation #62897

serhiy-storchaka opened this issue Aug 9, 2013 · 9 comments
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life 3.9 only security fixes docs Documentation in the Doc dir easy topic-C-API topic-unicode type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Aug 9, 2013

BPO 18697
Nosy @vstinner, @ezio-melotti, @serhiy-storchaka, @matheusportela, @Windsooon, @CraftSpider
PRs
  • gh-62897: Update PyUnicode parameter names #12680
  • 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 = None
    created_at = <Date 2013-08-09.18:48:46.553>
    labels = ['easy', '3.7', '3.8', '3.9', 'expert-C-API', 'type-feature', 'expert-unicode', 'docs']
    title = 'Unify arguments names in Unicode object C API documentation'
    updated_at = <Date 2019-12-09.16:13:02.233>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2019-12-09.16:13:02.233>
    actor = 'vstinner'
    assignee = 'docs@python'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation', 'Unicode', 'C API']
    creation = <Date 2013-08-09.18:48:46.553>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 18697
    keywords = ['patch', 'easy']
    message_count = 9.0
    messages = ['194755', '224600', '224609', '231274', '249437', '337589', '339088', '339420', '347171']
    nosy_count = 8.0
    nosy_names = ['vstinner', 'ezio.melotti', 'docs@python', 'serhiy.storchaka', 'matheus.v.portela', 'Windson Yang', 'Rune Tynan', 'Philip Dye']
    pr_nums = ['12680']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue18697'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    Linked PRs

    @serhiy-storchaka
    Copy link
    Member Author

    In declarations of Unicode object C API functions in Doc/c-api/unicode.rst the first Unicode object argument has different names: "unicode", "str", "u", "s". It will be good to unify these names.

    Of course there is no need to change reasonable argument names for such functions as PyUnicode_Concat() or PyUnicode_CopyCharacters().

    @serhiy-storchaka serhiy-storchaka added docs Documentation in the Doc dir topic-unicode easy type-feature A feature request or enhancement labels Aug 9, 2013
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Aug 3, 2014

    @serhiy will you be proposing a patch for this?

    @serhiy-storchaka
    Copy link
    Member Author

    @serhiy will you be proposing a patch for this?

    No, I am not. I have no opinion what name is better.

    @serhiy-storchaka
    Copy link
    Member Author

    The same issue exists for other types. E.g. PyLong_* functions have Python long argument named as p, obj and pylong, PyFloat_* -- p and pyfloat, PyList_* -- p and list, PyDict_* -- p, a and mapping, PyBytes_* -- o, obj, string and bytes.

    @matheusportela
    Copy link
    Mannequin

    matheusportela mannequin commented Aug 31, 2015

    Just checking, it would be required to update Objects/unicodeobject.c, Include/unicodeobject.h, and Doc/c-api/unicode.rst, right?

    As far as I saw, "unicode" means a Python object with unicode string, "u" is a UTF-8 encoded C string, "str" and "s" are encoded C strings (UTF-8, UTF-7, ASCII, Latin-1, among others). Is it alright to rename Python unicode objects to "unicode" and the others to simply "str"? These names are more meaningful than the single character alternatives.

    The same logic would be applied to the other types, always keeping the longer name rather than the single character ones.

    @Windsooon
    Copy link
    Mannequin

    Windsooon mannequin commented Mar 10, 2019

    I agreed with @matheus, it would be better than the current implementation

    @Windsooon Windsooon mannequin added the 3.7 (EOL) end of life label Mar 10, 2019
    @CraftSpider
    Copy link
    Mannequin

    CraftSpider mannequin commented Mar 29, 2019

    I have some interest in making a fix for this. From discussion, I'm thinking that, barring names that already have clear meaning (EG, left/right for things with two parameters):

    • PyObject* that is unknown type remains obj
    • PyObject* with unicode string is unicode
    • const char*, const Py_UNICODE*, and const wchar* becomes str
    • const char, const Py_UNICODE, and const wchar become ch

    Those seem to be the intersect of most common and most descriptive names already seen.

    @CraftSpider
    Copy link
    Mannequin

    CraftSpider mannequin commented Apr 4, 2019

    Another inconsistency I've noticed is that the code sometimes refers to Py_ssize_t instances as a 'length' and sometimes as a 'size'. It seems like 'size' is the more common one in the docs, but the headers more often use 'length'. Which would be the better one to keep for the common case?

    @CraftSpider
    Copy link
    Mannequin

    CraftSpider mannequin commented Jul 2, 2019

    It has been over a month and I'm still waiting for an updated PR review. I understand if people are busy, but don't want this to just fall through the cracks.

    @matrixise matrixise added 3.8 (EOL) end of life 3.9 only security fixes labels Sep 11, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    serhiy-storchaka added a commit that referenced this issue Dec 5, 2023
    Standardize PyUnicode C API parameter names across the documentation.
    
    Co-authored-by: Serhiy Storchaka <[email protected]>
    serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Dec 5, 2023
    …GH-12680)
    
    Standardize PyUnicode C API parameter names across the documentation.
    
    (cherry picked from commit b31232d)
    
    Co-authored-by: Rune Tynan <[email protected]>
    Co-authored-by: Serhiy Storchaka <[email protected]>
    serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Dec 5, 2023
    …GH-12680)
    
    Standardize PyUnicode C API parameter names across the documentation.
    
    (cherry picked from commit b31232d)
    
    Co-authored-by: Rune Tynan <[email protected]>
    Co-authored-by: Serhiy Storchaka <[email protected]>
    serhiy-storchaka added a commit that referenced this issue Dec 5, 2023
    …H-112744)
    
    Standardize PyUnicode C API parameter names across the documentation.
    
    (cherry picked from commit b31232d)
    
    Co-authored-by: Rune Tynan <[email protected]>
    serhiy-storchaka added a commit that referenced this issue Dec 5, 2023
    …H-112745)
    
    Standardize PyUnicode C API parameter names across the documentation.
    
    (cherry picked from commit b31232d)
    
    Co-authored-by: Rune Tynan <[email protected]>
    aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
    Standardize PyUnicode C API parameter names across the documentation.
    
    Co-authored-by: Serhiy Storchaka <[email protected]>
    Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
    Standardize PyUnicode C API parameter names across the documentation.
    
    Co-authored-by: Serhiy Storchaka <[email protected]>
    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 3.8 (EOL) end of life 3.9 only security fixes docs Documentation in the Doc dir easy topic-C-API topic-unicode type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants