home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

15 rows where issue = 128980804 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 6

  • shoyer 4
  • MathieuSchopfer 4
  • mivade 2
  • max-sixty 2
  • rafa-guedes 2
  • jhamman 1

author_association 3

  • MEMBER 7
  • CONTRIBUTOR 4
  • NONE 4

issue 1

  • Cannot inherit DataArray anymore in 0.7 release · 15 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
303795305 https://github.com/pydata/xarray/issues/728#issuecomment-303795305 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDMwMzc5NTMwNQ== mivade 2805515 2017-05-24T17:30:35Z 2017-05-24T17:30:35Z CONTRIBUTOR

Thanks, I missed that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
303794677 https://github.com/pydata/xarray/issues/728#issuecomment-303794677 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDMwMzc5NDY3Nw== shoyer 1217238 2017-05-24T17:28:21Z 2017-05-24T17:28:21Z MEMBER

Is there a reason inheritance with a different init signature can't be allowed?

No strong reason -- we just didn't really consider (or test) inheritance in the current design. Certainly proposals (and PRs) for a subclassing API would be welcome.

At the very least, a big fat warning in the documentation would be helpful.

http://xarray.pydata.org/en/stable/internals.html#extending-xarray has some related guidance (I agree it could be louder)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
303792391 https://github.com/pydata/xarray/issues/728#issuecomment-303792391 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDMwMzc5MjM5MQ== mivade 2805515 2017-05-24T17:19:38Z 2017-05-24T17:19:38Z CONTRIBUTOR

This is a really painful bug since it leads to all sorts of obscure error messages. Is there a reason inheritance with a different __init__ signature can't be allowed? At the very least, a big fat warning in the documentation would be helpful.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
193930364 https://github.com/pydata/xarray/issues/728#issuecomment-193930364 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE5MzkzMDM2NA== MathieuSchopfer 17726101 2016-03-08T19:23:37Z 2016-03-08T19:23:37Z NONE

That's the point of this issue, why. Read this comment of @shoyer.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
193885079 https://github.com/pydata/xarray/issues/728#issuecomment-193885079 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE5Mzg4NTA3OQ== max-sixty 5635139 2016-03-08T17:44:07Z 2016-03-08T17:44:07Z MEMBER

@MaximilianR Okay, but this won't solve the current issue. If you override the init method when trying to subclass DataArray, subsequent accesses to some attributes (e.g. coords) will fail. No matter if you super up or not.

Why?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
193883587 https://github.com/pydata/xarray/issues/728#issuecomment-193883587 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE5Mzg4MzU4Nw== MathieuSchopfer 17726101 2016-03-08T17:39:07Z 2016-03-08T17:39:07Z NONE

@MaximilianR Okay, but this won't solve the current issue. If you override the __init__ method when trying to subclass DataArray, subsequent accesses to some attributes (e.g. coords) will fail. No matter if you super up or not.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
193876807 https://github.com/pydata/xarray/issues/728#issuecomment-193876807 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE5Mzg3NjgwNw== jhamman 2443309 2016-03-08T17:22:09Z 2016-03-08T17:22:09Z MEMBER

Also, even in OOP, I'm not sure every class needs to be designed to support inheritance. There are obvious applications where that is not practical.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
193875239 https://github.com/pydata/xarray/issues/728#issuecomment-193875239 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE5Mzg3NTIzOQ== max-sixty 5635139 2016-03-08T17:17:31Z 2016-03-08T17:17:31Z MEMBER

Well, I think pure OOP should support class inheritance. In this case, you can subclass DataArray only if you do not customise the init method, which is not true inheritance ...

That's not the pythonic perspective (although I can see the attraction). The pythonic way is to override __init__ and super up

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
193869538 https://github.com/pydata/xarray/issues/728#issuecomment-193869538 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE5Mzg2OTUzOA== MathieuSchopfer 17726101 2016-03-08T17:03:33Z 2016-03-08T17:03:33Z NONE

Well, I think pure OOP should support class inheritance. In this case, you can subclass DataArray only if you do not customise the __init__ method, which is not true inheritance ...

Yes, I have an alternative to suggest: initialise subclass instances in two steps, by creating a public method init(self, ...) or initialise(self, ...) to set custom attributes.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
193863403 https://github.com/pydata/xarray/issues/728#issuecomment-193863403 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE5Mzg2MzQwMw== shoyer 1217238 2016-03-08T16:53:15Z 2016-03-08T16:53:15Z MEMBER

@mathieuS87 I'm not quite sure what you mean there. Do you have a suggested alternative?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
193846664 https://github.com/pydata/xarray/issues/728#issuecomment-193846664 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE5Mzg0NjY2NA== MathieuSchopfer 17726101 2016-03-08T16:21:55Z 2016-03-08T16:24:32Z NONE

@shoyer Then it is not OOP any more ...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
176542303 https://github.com/pydata/xarray/issues/728#issuecomment-176542303 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE3NjU0MjMwMw== rafa-guedes 7799184 2016-01-29T02:48:17Z 2016-01-29T02:48:17Z CONTRIBUTOR

Thanks @shoyer that works (:

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
176488063 https://github.com/pydata/xarray/issues/728#issuecomment-176488063 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE3NjQ4ODA2Mw== shoyer 1217238 2016-01-29T00:00:08Z 2016-01-29T00:00:08Z MEMBER

@rafa-guedes the __init__ method needs to look like that of DataArray, e.g.,

class NewArray(xr.DataArray): def __init__(self, data, coords=None, dims=None, name=None, attrs=None, encoding=None, fastpath=False): # ...

or even simply:

class NewArray(xr.DataArray): def __init__(self, *args, **kwargs): # ...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
176485011 https://github.com/pydata/xarray/issues/728#issuecomment-176485011 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE3NjQ4NTAxMQ== rafa-guedes 7799184 2016-01-28T23:44:58Z 2016-01-28T23:44:58Z CONTRIBUTOR

Thanks @shoyer , what do you mean by preserve the signature of DataArray.__init__ please?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804
175394725 https://github.com/pydata/xarray/issues/728#issuecomment-175394725 https://api.github.com/repos/pydata/xarray/issues/728 MDEyOklzc3VlQ29tbWVudDE3NTM5NDcyNQ== shoyer 1217238 2016-01-27T04:47:50Z 2016-01-27T04:47:50Z MEMBER

This was definitely caused by the refactor of DataArray internals in 0.7.0.

I don't think you were doing anything wrong, per se, it's just that the internal refactor changed what you can do with a subclasses in an unexpected way :(.

On the plus side, the new code should be better about preserving DataArray subclasses -- new DataArrays should be to the same type as parent objects. However, you will need to preserve the signature of DataArray.__init__, or replace the private _replace method on your subclass (I don't recommend this, because it's also definitely private API and not guaranteed to continue to work).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Cannot inherit DataArray anymore in 0.7 release 128980804

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 14.27ms · About: xarray-datasette