home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 410121888

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/2292#issuecomment-410121888 https://api.github.com/repos/pydata/xarray/issues/2292 410121888 MDEyOklzc3VlQ29tbWVudDQxMDEyMTg4OA== 1217238 2018-08-03T02:04:33Z 2018-08-03T02:04:33Z MEMBER

I disagree that base classes aren't very pythonic.

I should have said that required base classes don't feel very Pythonic. I'm not opposed to base classes in principle, and I'm definitely sympathetic to a desire to use static typing. See also https://github.com/pydata/xarray/issues/1900 for related discussion.

One consideration is what the advantages are of using enums over "dummy enums" like: class A: X = 'X' Y = 'Y' Z = 'Z' (i.e., constants in a namespace)

You can still refer to these programmatically like A.X, but I guess the string repr is different. On the plus side, "dummy enums" will serialize/deserialize perfectly to strings (because they are indeed strings).

I don't love the sound of names that deserialize to different types than their inputs. That seems very error prone, even if you do your best to overload all the special methods like __eq__.

What does seems like potentially a better idea to me would be a library with dedicated loader functions that "destringify" names by turning them back into enum objects.

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