python / python/mypy

Dynamically creating type unions from a list of types

Open
#16,671 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Feature

I was trying to create a Router which takes a list of functions as input and based on these functions I want to dynamically create a generic output type which contains the Union of all function outputs.

Pitch

This would allow really complex routing to be typesafe.

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.

Research direction

No file, test, or entry point is named. Start by reviewing mypy's existing generic type inference and callable typing behavior, then define how a list of functions would produce a union type; done requires an agreed design and tests covering the proposed routing pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.