Function composition in Python3
Suggestions for compose:



def compose(*fargs):
    def inner(arg):
        if not arg:
            raise ValueError("Invalid argument")
        if not all([callable(f) for f in fargs]):
            raise TypeError("Function is not callable")
        return reduce(lambda arg, func: func(arg), fargs, arg)
    return inner



if not arg: What's wrong with arg being falsey? Perhaps that's an acceptable input. Input validation should be designated to the functions being composed, which can raise their own errors.
if not all([callable(f) ...: This line should be before def inner(args). It should be a single-time input validation to ensure that all given inputs in fargs are callable. Currently, it checks needless amounts of times (each inner call) and does not check immediately.
if not all([callable(f) ...: You can use a generator expression instead of a list comprehension for this, slightly improving readability.


If both of these suggestions are implemented, your compose would look like:

def compose(*fargs):
    if not all(callable(f) for f in fargs):
        raise TypeError("Function is not callable")
    def inner(arg):
        return reduce(lambda arg, func: func(arg), fargs, arg)
    return inner


Please tell me if I have misunderstood your code.