PEP-484 provides semantics for type annotations. These are geared very much towards a) documentation and b) help for IDEs. They are less geared towards code optimization.
For example, it is unfortunately not possible to use PEP 484 annotations either with Cython https://groups.google.com/d/msg/cython-users/DHcbk78rDec/6-b5XtCRGBEJ
or with Numba, the latter using its own annotation format in the form of strings like "float64(int32, int32)" http://numba.pydata.org/numba-doc/0.24.0/reference/types.html
How do I work within the framework of PEP 484 with my own types? I explicitly do not want to break PEP-484 semantics, but augment the existing types with additional information visible to my own type checker, but invisible to any PEP-484 conforming type checker or IDE.
Will the following be interpreted within the PEP-484 semantics as List[int]?
class Int32(int): pass
x = [1] # type: List[Int32]
How about a more fancy type like this?
def combine(typeA, typeB):
class X(typeA, typeB): pass
return X
class Metre(): pass
# is y an 'int' to PEP-484 typecheckers?
y = 1 # type: combine(Int32, Metre)
Any recommendations for libraries to work with type-hinting, both for type parsing and type checking?