laike9m / Python-Type-Challenges

Master Python typing (type hints) with interactive online exercises!
https://python-type-challenges.zeabur.app
MIT License
496 stars 31 forks source link

Fix: Remove function implementations to force return type to be checked. #120

Closed stewartHutchins closed 1 week ago

stewartHutchins commented 1 week ago

When completing the "generic" challengers the return type is not enforced. e.g.

def add[T](a: T, b: T) -> T:
    return a

def add[T](a: T, b: T):
    return a

both the above functions pass the first "generic" challenge

By removing the function implementation (return a) and replacing it with ..., the 2nd function in the above code snippet becomes an invalid.