Issue 20302: Argument Clinic: meaningful names for group flags (original) (raw)
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.
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.