Skip to content

Structural type hierarchy ? #6

@asmodehn

Description

@asmodehn

Having a look at #3 it seems the main benefit compared to functools.singledispatch is the ability to work on structural types.

Therefore I wonder if one can define a hierarchy of protocols via python-typeclasses and have them checked with mypy as well ?

These days I find myself wanting to use haskell concepts in my python code (that I want to keep for the prototyping/iterative development feel) and I guess I actually want to replace nominal typing in my code with structural types + strict dynamic typing, but I am not quite sure how to go about it.

I've been wanting for a while to attempt to implement typeclasses (metaclasses were my initial take), so I'm happy to find this, thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions