Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Typeclasses with several methods

Open
#83 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

No files, tests, or entry points are named. Start by tracing how the current typeclass mechanism represents and binds implementations, then determine how a Python Protocol with several methods, including the classmethod, should be supported. Done means the proposed Functor shape works and its implementation binding is defined and covered by tests.

Written by the indexing model from the issue text.

Description

enhancement help wanted

There's a common use-case when we need to create a type-class with several methods. Like:

class Functor(Protocol[T]):
    def map(self, function: Callable[[T], Functor[V]]) -> Functor[V]:
        ...

    @classmethod
    def from_value(cls, inner_value: V) -> Functor[V]:
        ...

Currently, there's no way we can do that.

I propose something like this:

@typeclass
class Functor(Protocol[T]):
    def map(self, function: Callable[[T], Functor[V]]) -> Functor[V]:
        ...

    @classmethod
    def from_value(cls, inner_value: V) -> Functor[V]:
        ...

I am not sure how to bound it to the actual implementation.

Dominant language
Python
Stars
730
Forks
30
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dry-python/classes

All issues in dry-python/classes

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.