agronholm / agronholm/typeguard

function compatability check

Open
#12 5 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
1.8k
Forks
145
Avg merge
8d 12h
Merged PRs (30d)
1

Description

Awesome project, I think it will be very useful.
One question, is there anything that might be used to check the compatibility between two functions?
I am imagining something like this:

```

from typing import List, Any, Sequence
from typeguard import functions_compatible

def f1(var1: int) -> List[int]:
return [var1]

def f2(var1: List[int]) -> Any:
return var1


functions_compatible(f1, f2) # True
functions_compatible(f2, f1) # True, because Any can be int
functions_compatible(f2, f1, strict=True) # False, because Any is not always int
```
I am working on a configurable data pipeline that is meant to run for a very long time, but the exact function connections are not always known until import time or later.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.