home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 368091406

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-368091406 https://api.github.com/repos/pydata/xarray/issues/1938 368091406 MDEyOklzc3VlQ29tbWVudDM2ODA5MTQwNg== 3064397 2018-02-23T18:08:30Z 2018-02-23T18:08:30Z NONE

In blaze we have variadic sequences for multiple dispatch, and the List[Union] case is something we have run into. We have a type called VarArgs which takes a variadic sequence of type-arguments and represents a sequence of a unions over the arguments, for example: VarArgs[pd.Series, pd.DataFrame] is a sequence of unknown length which is known to hold either series or dataframes. With some mild metaprogramming we made it so that VarArs[pd.Series] is a subclass of VarArgs[pd.Series, pd.DataFrame], or in general, more specific sequences are subclasses of more general sequences. This means that you can solve the ambiguity by registering a dispatch for VarArgs[np.ndarray] and VarArgs[np.ndarray, da.Array] and you know that the second function can only be called if the sequence holds at least one dask array.

Here is an example of what that looks like for merge, which is concat(axis=1): https://github.com/blaze/blaze/blob/master/blaze/compute/pandas.py#L691 This is the definition of VarArgs: https://github.com/blaze/blaze/blob/master/blaze/compute/varargs.py

{
    "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.957ms · About: xarray-datasette