Hacker News new | past | comments | ask | show | jobs | submit login

> For these cases, typing rules and annotations will be a boon.

You can use PEP3107 annotations today and automatically validate them using a decorator to eliminate boilerplate code like that. They don't have to be something to look forward to tomorrow.




Related: https://github.com/kislyuk/ensure

A (relatively) high performance runtime annotation type checker.

    from ensure import ensure_annotations
    
    @ensure_annotations
    def f(x: int, y: float) -> float:
        return x+y




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: