Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datatype info in LGDO classes #54

Open
gipert opened this issue Jan 11, 2024 · 0 comments
Open

Datatype info in LGDO classes #54

gipert opened this issue Jan 11, 2024 · 0 comments
Labels
types LGDO types

Comments

@gipert
Copy link
Member

gipert commented Jan 11, 2024

I find the way LGDO.dtype, LGDO.datatype_name(), LGDO.form_datatype() are named/implemented a bit confusing and I would propose the following refactor (Array in the example):

class Array(LGDO):
  def __init__(self, nda, **kwargs):
    # ...
    self.npdtype: DTypeLike = self.nda.dtype

    @property
    def datatype(self) -> str:
      return f"array<{self.ndim}>{utils.get_element_type(self)}"

such that

>>> a = Array([1, 2, 3])
>>> a.npdtype
int
>>> a.datatype
array<1>{real}

Thoughts?

@gipert gipert added the types LGDO types label Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types LGDO types
Projects
None yet
Development

No branches or pull requests

1 participant