home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where issue = 188113943 and user = 6213168 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • crusaderky · 5 ✖

issue 1

  • Better support for subclasses: tests, docs and API · 5 ✖

author_association 1

  • MEMBER 5
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
523885536 https://github.com/pydata/xarray/issues/1097#issuecomment-523885536 https://api.github.com/repos/pydata/xarray/issues/1097 MDEyOklzc3VlQ29tbWVudDUyMzg4NTUzNg== crusaderky 6213168 2019-08-22T12:32:37Z 2019-08-22T12:32:50Z MEMBER

Nevermind __slots__. I just tried and there is no noticeable speedup.

I had thought the primary saving was memory (and fairly significant with lots of objects)

It is one of the two savings - the other theoretically being attribute access time. I think I'll go on with a pull request for further discussion.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Better support for subclasses: tests, docs and API 188113943
523878745 https://github.com/pydata/xarray/issues/1097#issuecomment-523878745 https://api.github.com/repos/pydata/xarray/issues/1097 MDEyOklzc3VlQ29tbWVudDUyMzg3ODc0NQ== crusaderky 6213168 2019-08-22T12:12:42Z 2019-08-22T12:12:42Z MEMBER

Nevermind __slots__. I just tried and there is no noticeable speedup. Code at https://github.com/crusaderky/xarray/commit/26e0477759ce2ef9d1f8fd9d1b23234741517c5a

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Better support for subclasses: tests, docs and API 188113943
523842624 https://github.com/pydata/xarray/issues/1097#issuecomment-523842624 https://api.github.com/repos/pydata/xarray/issues/1097 MDEyOklzc3VlQ29tbWVudDUyMzg0MjYyNA== crusaderky 6213168 2019-08-22T10:17:27Z 2019-08-22T10:17:27Z MEMBER

There's also the argument that I would love, at some point, to migrate the xarray objects to use __slots__. From a quick benchmark on my mac, that speeds up every single attribute access by 7ns. I suspect that would very quickly add up. However, any subclass that defines extra attributes (as opposed to just methods) would break on the transition between __dict__ an __slots__.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Better support for subclasses: tests, docs and API 188113943
523834809 https://github.com/pydata/xarray/issues/1097#issuecomment-523834809 https://api.github.com/repos/pydata/xarray/issues/1097 MDEyOklzc3VlQ29tbWVudDUyMzgzNDgwOQ== crusaderky 6213168 2019-08-22T09:53:00Z 2019-08-22T09:53:45Z MEMBER

There's also a funny, pickle-friendly hack that allows you to add methods to a Dataset without subclassing it - thanks to the Dataset.__getattr__ magic: ``` def custom(self: Dataset, ...): ...

ds = Dataset(...) ds.attrs['custom'] = partial(custom, ds) ds.custom(...) ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Better support for subclasses: tests, docs and API 188113943
523833526 https://github.com/pydata/xarray/issues/1097#issuecomment-523833526 https://api.github.com/repos/pydata/xarray/issues/1097 MDEyOklzc3VlQ29tbWVudDUyMzgzMzUyNg== crusaderky 6213168 2019-08-22T09:49:00Z 2019-08-22T09:49:00Z MEMBER

The biggest problem is with all the Dataset methods and accessors that return a DataArray, and vice versa. Anybody who wants to create a coupled pair of Dataset and DataArray subclasses will need to hunt down all methods and accessors that return the other class in the pair and override them.

May I ask what are the practical use cases for subclassing? In several years worth of day-to-day use of xarray I always found that encapsulation felt much more natural.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Better support for subclasses: tests, docs and API 188113943

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 807.619ms · About: xarray-datasette