This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Argument Clinic: meaningful names for group flags
Type: enhancement Stage: resolved
Components: Build, Demos and Tools Versions: Python 3.4
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: larry, serhiy.storchaka
Priority: low Keywords:

Created on 2014-01-19 13:11 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg208476 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-19 13:11
Currently flags for optional groups are named as group_left_N and  group_right_N. It will be better if they have names use_param, use_param1_param2, etc. E.g. following declaration:

/*[clinic input]
curses.window.addstr

    self: self(type="PyCursesWindowObject *")
    [
    y: int
        Y-coordinate.
    x: int
        X-coordinate.
    ]

    str: object
        String to add.

    [
    attr: long
        Attributes for the character.
    ]
    /

[clinic start generated code]*/

Should produce signature:

static PyObject *
curses_window_addstr_impl(PyCursesWindowObject *self, int use_x_y, int y, int x, PyObject *str, int use_attr, long attr)

(Existing non-clinicalized code use use_xy and use_attr flags).
This will make the code a little cleaner.
msg208737 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-22 03:05
Well, they're going to have to change somehow, because the concepts of "left" and "right" are going away (see #20303).  However, your suggested new name for these functions would be awful for large groups.  Consider curses.window.overlay:

window.overlay(destwin[, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol])

Your algorithm would generate the name "use_destwin_sminrow_smincol_dminrow_dmincol_dmaxrow_dmaxcol".


I suggest instead: remap the names to less-confusing names in your
impl function.  Compiler optimization will make the redundant name disappear, so it will have no run-time cost.
History
Date User Action Args
2022-04-11 14:57:57adminsetgithub: 64501
2014-01-22 03:05:59larrysetstatus: open -> closed
resolution: wont fix
messages: + msg208737

stage: needs patch -> resolved
2014-01-19 13:11:53serhiy.storchakacreate