Promises is a simple Python library for the runtime enforcement of types during function calls. It has the unfortunate fate of being the same name as the Javascript pattern. Usage examples:
@accepts(AnyOf[int,float])
@returns(str)
def f(x):
return str(x)
Note the getitem
magic implemented in the AnyOf
pseudo-type. These pseudo-types can be combined like
logical operators to create long, hard-to-grok type
signatures. The current iteration of Promises hopes
to streamline the library from it's previous cluttered
state.