home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 368100305

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/1938#issuecomment-368100305 https://api.github.com/repos/pydata/xarray/issues/1938 368100305 MDEyOklzc3VlQ29tbWVudDM2ODEwMDMwNQ== 3064397 2018-02-23T18:39:50Z 2018-02-23T18:40:46Z NONE

VarArgs itself is actually a type, so you need to create instances which wrap the list argument, for example:

```python In [1]: from blaze.compute.varargs import VarArgs

In [2]: from multipledispatch import dispatch

In [3]: @dispatch(VarArgs[float]) ...: def f(args): ...: print('floats') ...:

In [4]: @dispatch(VarArgs[str]) ...: def f(args): ...: print('strings') ...:

In [5]: @dispatch(VarArgs[str, float]) ...: def f(args): ...: print('mixed') ...:

In [6]: f(VarArgs(['foo'])) strings

In [7]: f(VarArgs([1.0])) floats

In [8]: f(VarArgs([1.0, 'foo'])) mixed

In [9]: VarArgs([1.0, 'foo']) Out[9]: VarArgsfloat, str ```

You could hide this behind a top-level function that wraps the input for the user, or register a dispatch for list which boxes and recurses into itself.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  299668148
Powered by Datasette · Queries took 0.694ms · About: xarray-datasette