type_error_msg

emlib.misc.type_error_msg(x, *expected_types)[source]

To be used when raising a TypeError

Example:

if isinstance(x, int):
    ...
else:
    raise TypeError(type_error_msg(x, int))

# This will raise a TypeError with the message
# 'Expected type (int,), got str: "foo"'