[scikit-learn] make all new parameters keyword-only?

Andreas Mueller t3kcit at gmail.com
Thu Nov 15 08:59:08 EST 2018


On 11/15/18 6:35 AM, Joel Nothman wrote:
> I think there are cases where the first few arguments would be better 
> to maintain as positional, but users would very rarely use more than 
> two, and we have long assumed keyword arguments in most cases, and 
> never received complaints when we have inserted not at the end or 
> deprecated in the middle.
>
> I would expect that forcing all params after the first two (or three) 
> to be keyword arguments would formalise existing tacit assumptions, 
> would benefit maintainability, and would break very little code.
>
I was about to say "you expect but we have no way to measure that".

But then I realized we totally have a way to measure that (if using the 
open source code on bigquery counts).

I could try to see if people use positional arguments and where. No 
promise on timeline though.
I think there is little harm in doing it for new parameters while we 
figure this out, though?


> On Thu, 15 Nov 2018 at 20:34, Gael Varoquaux 
> <gael.varoquaux at normalesup.org <mailto:gael.varoquaux at normalesup.org>> 
> wrote:
>
>     I am really in favor of the general idea: it is much better to use
>     named
>     arguments for everybody (for readability, and to be less depend on
>     parameter ordering).
>
>     However, I would maintain that we need to move slowly with backward
>     compatibility: changing in a backward-incompatible way a library
>     brings
>     much more loss than benefit to our users.
>
>     So +1 for enforcing the change on all new arguments, but -1 for
>     changing
>     orders in the existing arguments any time soon.
>
>     I agree that it would be good to push this change in existing
>     models. We
>     should probably announce it strongly well in advance, make sure
>     that all
>     our examples are changed (people copy-paste), wait a lot, and find a
>     moment to squeeze this in.
>
>     Gaël
>
>     On Thu, Nov 15, 2018 at 06:12:35PM +1100, Joel Nothman wrote:
>     > We could just announce that we will be making this a syntactic
>     constraint from
>     > version X and make the change wholesale then. It would be less
>     formal backwards
>     > compatibility than we usually hold by, but we already are loose
>     with parameter
>     > ordering when adding new ones.
>
>     > It would be great if after this change we could then reorder
>     parameters to make
>     > some sense!
>
>     > _______________________________________________
>     > scikit-learn mailing list
>     > scikit-learn at python.org <mailto:scikit-learn at python.org>
>     > https://mail.python.org/mailman/listinfo/scikit-learn
>
>
>     -- 
>         Gael Varoquaux
>         Senior Researcher, INRIA Parietal
>         NeuroSpin/CEA Saclay , Bat 145, 91191 Gif-sur-Yvette France
>         Phone:  ++ 33-1-69-08-79-68
>     http://gael-varoquaux.info http://twitter.com/GaelVaroquaux
>     _______________________________________________
>     scikit-learn mailing list
>     scikit-learn at python.org <mailto:scikit-learn at python.org>
>     https://mail.python.org/mailman/listinfo/scikit-learn
>
>
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20181115/96516a85/attachment.html>


More information about the scikit-learn mailing list