python/typing

Idenity Type

julien-blanchon opened this issue · 2 comments

I'm trying to type such functions:

def identity[T](*args: T) -> T:
    # Modify the arguments in some way but keep the same type
    ...
    new_args = args
    # Return the modified arguments
    return new_args

I would like to be able to have such behaviour:

new_a, new_b, new_c = identity(a, b, c)

With a, b and c of type different A, B, C

Tasks

No tasks being tracked yet.

Waw this is great ! Thanks a lot