[scikit-learn] Vote on SLEP009: keyword only arguments

Andreas Mueller t3kcit at gmail.com
Wed Sep 18 11:24:55 EDT 2019


The SLEP says:

This proposal suggests making only/most commonly/used parameters 
positional. The/most commonly/used parameters are defined per method or 
function, to be defined as either of the following two ways:

  * The set defined and agreed upon by the core developers, which should
    cover the/easy/cases.
  * A set identified as being in the top 95% of the use cases, using
    some automated analysis such asthis one
    <https://odyssey.readthedocs.io/en/latest/tutorial.html>orthis one
    <https://github.com/Quansight-Labs/python-api-inspect>.

And describes a clear deprecation path.

So that seems pretty actionable?


Also, I vote +1 on the SLEP.

Nicolas: Do you think this is not actionable? I had suggested that we 
define a clear rule but doing a case-by-case seems better than 
bikeshedding now.

Alexandre: did you read the SLEP before asking? I thought the point of 
the SLEP was to summarize the discussion. If your question is not 
answered we should amend the SLEP.



On 9/11/19 2:21 PM, Nicolas Hug wrote:
>
> Since there is no explicit proposal in the SLEP it's not very clear 
> what we need to vote for / against?
>
> But overall I'm  + 1 on forcing kwargs for all __init__ methods.
>
>
> Nicolas
>
>
> On 9/11/19 9:38 AM, Adrin wrote:
>> Hi,
>>
>> I'm (mostly) the messenger, don't shoot me :P
>>
>> It may help to summarize the SLEP:
>> 1. This can be applied to all methods, not just __init__.
>> 2. The SLEP doesn't say we have to apply it everywhere. It's mostly 
>> that it lets us do that.
>> 3. It doesn't make ALL inputs a keywords only argument. The common 
>> ones such as X and y in fit(X, y) will stay as they are.
>> Therefore clf.fit(X, y) will definitely be allowed.
>> 4. Whether or not sample_weight should be keyword only or not in fit, 
>> requires its own discussion, and the route of the discussion
>>    is defined in the SLEP.
>>
>> In other words, if an input parameter is used as a positional 
>> argument less frequently than X% of the time, then it can/should be
>> a keyword only argument. But the SLEP better defines these conditions.
>>
>> I hope that clarifies it a little bit.
>>
>> Adrin/
>>
>> On Wed, Sep 11, 2019 at 3:23 PM Alexandre Gramfort 
>> <alexandre.gramfort at inria.fr <mailto:alexandre.gramfort at inria.fr>> wrote:
>>
>>     hi,
>>
>>     Adrin do you suggest this for everything or maybe just for __init__
>>     params of estimators
>>     and stuff that can come after X, y in fit eg sample_weights?
>>
>>     would:
>>
>>     clf.fit(X, y)
>>
>>     still be allowed?
>>
>>     Alex
>>     _______________________________________________
>>     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
>
> _______________________________________________
> 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/20190918/7767df89/attachment.html>


More information about the scikit-learn mailing list