How to use the multimethod.__init__.subtype function in multimethod

To help you get started, we’ve selected a few multimethod examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coady / multimethod / multimethod / __init__.py View on Github external
def __new__(cls, types: Iterable):
        return tuple.__new__(cls, map(subtype, types))
github coady / multimethod / multimethod / __init__.py View on Github external
def __eq__(self, other):
        return isinstance(other, subtype) and self.__getstate__() == other.__getstate__()
github coady / multimethod / multimethod / __init__.py View on Github external
def get_type(arg: Iterable):
    """Return generic type checking first value."""
    return subtype(type(arg), *map(get_type, itertools.islice(arg, 1)))