+1 on this. Typeshed is full of examples of extra overloads due to this. Mainly
because of a case where a parameter with a default argument isn't actually
optional (ie, using the default argument would necessary lead to an error).
openpyxl stubs in particular is chockful of them.
___
On 11/9/21 3:24 PM, Terry Reedy wrote:
On 11/9/2021 1:52 PM, Sebastian Rittau wrote:
Am 09.11.21 um 19:26 schrieb Terry Reedy:
The signature of Sebastian's function with honest parameter names is
foo(x_or_y, required_y=_NotGiven, /). It is the 2nd argument, not
the first, that is optional, as
On Tue, Nov 9, 2021 at 12:27 PM Terry Reedy wrote:
> On 11/9/2021 1:52 PM, Sebastian Rittau wrote:
> > Am 09.11.21 um 19:26 schrieb Terry Reedy:
> >> The signature of Sebastian's function with honest parameter names is
> >> foo(x_or_y, required_y=_NotGiven, /). It is the 2nd argument, not the
>
On 11/9/2021 1:52 PM, Sebastian Rittau wrote:
Am 09.11.21 um 19:26 schrieb Terry Reedy:
The signature of Sebastian's function with honest parameter names is
foo(x_or_y, required_y=_NotGiven, /). It is the 2nd argument, not the
first, that is optional, as with range. If required_y is not given
Am 09.11.21 um 19:26 schrieb Terry Reedy:
The signature of Sebastian's function with honest parameter names is
foo(x_or_y, required_y=_NotGiven, /). It is the 2nd argument, not the
first, that is optional, as with range. If required_y is not given,
than x_or_y must be y, and x is given a defa
On 11/9/2021 9:23 AM, Steven D'Aprano wrote:
By the way, this discussion is probably better suited to the
Python-Ideas mailing list. But since we're here...
On Tue, Nov 09, 2021 at 11:37:40AM +0100, Sebastian Rittau wrote:
To me, the "natural" solution looks like this:
def foo(x=None, y): ...
On Tue, Nov 9, 2021 at 6:31 AM Steven D'Aprano wrote:
> By the way, this discussion is probably better suited to the
> Python-Ideas mailing list. But since we're here...
>
> On Tue, Nov 09, 2021 at 11:37:40AM +0100, Sebastian Rittau wrote:
>
> > >>To me, the "natural" solution looks like this:
>
Am 09.11.21 um 13:44 schrieb Petr Viktorin:
And for the "encoding" case: IMO, varying the return type based on an
optional "encoding" argument" is a holdover from the pre-typing era,
when return types were only specified in the documentation -- just
like "addch" is a holdover from the days when
By the way, this discussion is probably better suited to the
Python-Ideas mailing list. But since we're here...
On Tue, Nov 09, 2021 at 11:37:40AM +0100, Sebastian Rittau wrote:
> >>To me, the "natural" solution looks like this:
> >>
> >>def foo(x=None, y): ...
[...]
Chris Angelico asked:
> >Wh
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
On 09. 11. 21 10:50, Chris Angelico wrote:
On Tue, Nov 9, 2021 at 8:38 PM Sebastian Rittau wrote:
Currently, Python doesn't allow non-default arguments after default
arguments:
>>> def foo(x=None, y): pass
File "", line 1
def foo(x=None, y): pass
^
Syntax
On Tue, 9 Nov 2021 at 10:39, Sebastian Rittau wrote:
> This might be better API design (although I don't think Python should be
> opinionated about this outside the standard library), but this still
> leaves the API change example and the very real problem of @overloads
> unsolved.
You can handl
Am 09.11.21 um 10:50 schrieb Chris Angelico:
On Tue, Nov 9, 2021 at 8:38 PM Sebastian Rittau wrote:
Currently, Python doesn't allow non-default arguments after default
arguments:
>>> def foo(x=None, y): pass
File "", line 1
def foo(x=None, y): pass
^
SyntaxEr
On Tue, Nov 9, 2021 at 8:38 PM Sebastian Rittau wrote:
>
> Currently, Python doesn't allow non-default arguments after default
> arguments:
>
> >>> def foo(x=None, y): pass
>File "", line 1
> def foo(x=None, y): pass
> ^
> SyntaxError: non-default argument follows d
14 matches
Mail list logo