You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Antoine Pitrou (Jira)" <ji...@apache.org> on 2021/12/14 16:57:00 UTC

[jira] [Commented] (ARROW-14766) [Python] compute function arguments cannot be passed by name, despite the exposed signature

    [ https://issues.apache.org/jira/browse/ARROW-14766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17459314#comment-17459314 ] 

Antoine Pitrou commented on ARROW-14766:
----------------------------------------

Ok, I think we can just update the reflected signature to indicate that the parameters are positional-only.

> [Python] compute function arguments cannot be passed by name, despite the exposed signature
> -------------------------------------------------------------------------------------------
>
>                 Key: ARROW-14766
>                 URL: https://issues.apache.org/jira/browse/ARROW-14766
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>            Reporter: Antoine Pitrou
>            Priority: Minor
>
> Example:
> {code:python}
> >>> pc.is_in_meta_binary?
> Signature: pc.is_in_meta_binary(values, value_set, *, memory_pool=None)
> Docstring:
> Find each element in a set of values.
> For each element in `values`, return true if it is found in `value_set`,
> false otherwise.
> Parameters
> ----------
> values : Array-like or scalar-like
>     Argument to compute function
> value_set : Array-like or scalar-like
>     Argument to compute function
> memory_pool : pyarrow.MemoryPool, optional
>     If not passed, will allocate memory from the default memory pool.
> File:      ~/arrow/dev/python/pyarrow/compute.py
> Type:      function
> {code}
> {code:python}
> >>> pc.is_in_meta_binary(["a", "b", "c"], ["a", "b"])
> <pyarrow.lib.BooleanArray object at 0x7f63c5dfad00>
> [
>   true,
>   true,
>   false
> ]
> >>> pc.is_in_meta_binary(["a", "b", "c"], value_set=["a", "b"])
> Traceback (most recent call last):
>   File "<ipython-input-5-ea763d55e2a9>", line 1, in <module>
>     pc.is_in_meta_binary(["a", "b", "c"], value_set=["a", "b"])
> TypeError: wrapper() got an unexpected keyword argument 'value_set'
> {code}
> Two possible solutions:
> * mark the argument positional-only
> * (better) change the generated wrapper to accept said named arguments



--
This message was sent by Atlassian Jira
(v8.20.1#820001)