from typing import Callable class Caller : def __init__(self, ): pass def __or__(self, callable: Callable) : return callable() def __and__(self, callable: Callable): return callable() if __name__ == "__main__": caller = Caller() caller | (lambda: print("That should be printed")) caller & (lambda: print("That should be printed"))