[ https://issues.apache.org/jira/browse/SPARK-32933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17201017#comment-17201017 ]
Maciej Szymkiewicz commented on SPARK-32933: -------------------------------------------- Not a problem [~hyukjin.kwon]. My only concern is that we still need a viable alternative for capturing arguments. {{locals}} hack does the job, especially if we add some helper for dropping {{self}} {code:python} def _drop_self(d): d = copy.copy(d) del d["self"] return d class BucketedRandomProjectionLSH(_LSH, _BucketedRandomProjectionLSHParams, HasSeed, JavaMLReadable, JavaMLWritable): def __init__(self, *, inputCol=None, outputCol=None, seed=None, numHashTables=1, bucketLength=None): kwargs = _drop_self(locals()) ... {code} Alternatively, we could just provide all the args explicitly. I guess we could also leverage `inspect` (optionally combined with class decorator? Just thinking out loud). > Use keyword-only syntax for keyword_only methods > ------------------------------------------------ > > Key: SPARK-32933 > URL: https://issues.apache.org/jira/browse/SPARK-32933 > Project: Spark > Issue Type: Improvement > Components: PySpark > Affects Versions: 3.1.0 > Reporter: Maciej Szymkiewicz > Assignee: Maciej Szymkiewicz > Priority: Minor > Fix For: 3.1.0 > > > Since 3.0, provides syntax for indicating keyword-only arguments ([PEP > 3102|https://www.python.org/dev/peps/pep-3102/]). > It is not a full replacement for our current usage of {{keyword_only}}, but > it would allow us to make our expectations explicit: > {code:python} > @keyword_only > def __init__(self, degree=2, inputCol=None, outputCol=None): > {code} > {code:python} > @keyword_only > def __init__(self, *, degree=2, inputCol=None, outputCol=None): > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org