News for hackers. Stuff that matters.
Re:Type checking in Python by cabalamat on Sunday May 18, 2014 @02:07PM (#7763753)
I wrote a similar python typechecker some time ago (https://github.com/cabalamat/ulib/blob/master/debugdec.md). My syntax is somewhat less verbose so this:

    @returns(int)
    @params(a=int, b=int)
    def add(a, b):
        return a + b
becomes:

    @typ(int, int, ret=int)
    def add(a, b):
        return a + b
I was inspired to do it like that by Haskell's very clean type syntax.

Senko's version has the advantage that you can compose types in it, e.g. {str:int} is a dictionary whose keys are strings and values are integers.

There are no comments on this comment yet.