IMO it was a bad idea to merge 2 ncurses C functions into a single
Python function. In the C API, there are two different functions:

* mvwadd_wch(win, y, x, char): 4 arguments
* wadd_wch(win, char): 2 arguments

The Python curses module could/can have a separated function when (y,
x) arguments are needed. Maybe it's not too late to deprecate the
current complex API when passing y and x, and add a new function which
accept (y, x).

As Petr explained, it's a headache to have such very complicated
function prototype :-(

Think about completion in code editor. What is the expected behavior
when pressing TAB key to complete on the code "window.addch(arg, " ?

Victor

On Tue, Nov 9, 2021 at 1:47 PM Petr Viktorin <encu...@gmail.com> wrote:
> A more extreme case is functions with an optional *group*. In curses,
> the first two arguments to addch are optional. In `help()` it's
> documented as `window.addch([y, x,] ch[, attr=...])` and you can call it
> as one of:
>
> window.addch(ch)
> window.addch(ch, attr)
> window.addch(y, x, ch)
> window.addch(y, x, ch, attr)
>
> see: https://docs.python.org/3/library/curses.html#curses.window.addch
>
> Supporting this was a headache for Argument Clinic (PEP 436), and AFAIK
> it still isn't possible to express this as an inspect.Signature (PEP 362).
>
> Allowing non-default arguments after default arguments would mean
> introspection tools (and code that uses them) would need to be changed
> to prepare for the new possibilities. It's not free.

-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/47YCD5UA2JGQEVASBNUTAK7GQ4CLVV7E/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to