Hello everyone! I want to see what's your opinion on allowing functions to return types and allow them to be used by a
mypy and other type checkers.
For context, I have a library that allows to annotate function arguments with some metadata, and it looks similar to this:
```python
def argument(name: str, description: str) -> dict:
return {"name": name, "description": description}
def get_user_name(id_: Annotated[int, argument(name="id", description="this should be an uuid")]) -> str | None:
return None
```
this works fine, but I was wondering if we could do something (or allow) like this:
```python
def argument(type_: T, *, name: str, description: str) -> T:
return Annotated[type_, {"name": name, "description": description}]
def get_user_name(id_: argument(int, name="id", description="this should be an uuid")) -> str | None:
return None
```
it might seem like a minor change, but to me it feels like it could improve the dx of my library 😊
Just to clarify, the goal is not to allow dynamic types, it is more to have a convenient way of making an
alias to lazy type
Let me know what you think