from typing import Callable class Foo: f: Callable def __init__(self, f: Callable): self.f = f # -> error: Cannot assign to a method