Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-14766

[Python] compute function arguments cannot be passed by name, despite the exposed signature

    XMLWordPrintableJSON

Details

    Description

      Example:

      >>> 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
      
      >>> 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'
      

      Two possible solutions:

      • mark the argument positional-only
      • (better) change the generated wrapper to accept said named arguments

      Attachments

        Issue Links

          Activity

            People

              apitrou Antoine Pitrou
              apitrou Antoine Pitrou
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m