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

feat[next]: variadic generic type #1486

Merged
merged 13 commits into from
Mar 13, 2024

Conversation

nfarabullini
Copy link
Contributor

@nfarabullini nfarabullini commented Mar 8, 2024

Variadic generic type:

ShapeT = TypeVarTuple("ShapeT")


class Dims(Generic[Unpack[ShapeT]]):
    shape: tuple[Unpack[ShapeT]]


DimsT = TypeVar("DimsT", bound=Dims, covariant=True)

such that field type is as follows:

Field[Dims[D0, D1, ...], DType]

@nfarabullini nfarabullini marked this pull request as draft March 8, 2024 13:13
@nfarabullini nfarabullini changed the title Variadic generic type feat[next]: variadic generic type Mar 11, 2024
@nfarabullini nfarabullini marked this pull request as ready for review March 11, 2024 13:22
Copy link
Contributor

@egparedes egparedes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me. We could also update the quickstart guide with the new syntax in this PR, or we can do it in a different PR? What do you think about it?

Copy link
Contributor

@egparedes egparedes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ILGTM

@nfarabullini nfarabullini merged commit d5b83a8 into GridTools:main Mar 13, 2024
39 checks passed
edopao pushed a commit to edopao/gt4py that referenced this pull request Mar 18, 2024
Variadic generic type: 
```python
ShapeT = TypeVarTuple("ShapeT")


class Dims(Generic[Unpack[ShapeT]]):
    shape: tuple[Unpack[ShapeT]]


DimsT = TypeVar("DimsT", bound=Dims, covariant=True)
```
such that field type is as follows: 
```python
Field[Dims[D0, D1, ...], DType]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants