News for hackers. Stuff that matters.
Re:Type hinting for Python by alexhill on Tuesday January 06, 2015 @02:21PM (#8846352)
Yeah, that gives me the heebie jeebies. Fair enough if you want to use magic comments for an entirely third-party system like MyPy, but using them for a built-in language feature feels wrong.

Besides, how necessary is it? Presumably those constrained types can be instantiated:

    x = Dict[str, str]()
The constrained type's __new__ would be annotated appropriately, and return an ordinary dict. It's a bit less "pure" in that this is no longer strictly an annotation, but I'd much prefer that bit of impurity than magic comments.

There are no comments on this comment yet.