News for hackers. Stuff that matters.
Re:Type checking in Python by gsg on Sunday May 18, 2014 @01:42PM (#7763684)
It's not hard to imagine an extension to ML-style types that could cover variadicity:

    map : ('a... -> 'b) -> ('a list)... -> 'b list
Where <type>... denotes <type1> -> <type2> -> ... -> <typeN> spliced into the type signature, with each type variable 'a in <type> replaced with 'a1, 'a2, ... 'aN. You could cover tuples too:

    zip : ('a list)... -> 'a,,, list
Bit ugly, and writing a type checker for it could be fun, but it seems workable.
Re:Type checking in Python by tel on Sunday May 18, 2014 @02:29PM (#7763828)
Take a look at Typed Racket for a variation on this.
Re:Type checking in Python by gsg on Sunday May 18, 2014 @03:53PM (#7764147)
Re:Type checking in Python by xiaq on Monday May 19, 2014 @12:57PM (#7768446)
Typed Racket is pretty decent.

However, behold the byzantine Scheme numerical tower and the effort to type it: http://www.ccs.neu.edu/home/stamourv/papers/numeric-tower.pd...

Re:Type checking in Python by xiaq on Monday May 19, 2014 @01:09PM (#7768516)
Fully typing variadicity in Python is only possible with dependent typing, since Python allows you to build the argument list dynamically. Generally speaking you can't even determine the number of arguments statically:

    args = []
    while some_condition():
        args.append('x')
    f(*args)
Typed Racket allows you type some common cases, though.