Skip to content

are the generic types worth it #96

@d-v-b

Description

@d-v-b

I am not convinced that using generics for GroupSpec and ArraySpec is worth it.

It's nice to be able to write

MyArray = ArraySpec[AttrsModel]

but I suspect many people find this confusing and would get more out of examples like

class MyArray(ArraySpec):
    attributes: AttrsModel

In principle the generic types could bring value for automatically generating return types of methods like GroupSpec.to_flat, but we can't really resolve the return value of to_flat because it collects everything from subgroups, and the type annotations of those subgroups are not easy to access.

So maybe it would be worth exploring a branch without the generic types. What would feel worse? I'm not sure! But I know a few things that would certainly feel better (like not needing to specialize GroupSpec all the time).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions