Before 3.9 I would have used this:
from typing import Callable
def my_function(argument_function: Callable) -> None:
Now I am not sure anymore.
PEP 585 has a list of deprecated Typing-types that does not include typing.Callable
but does include collections.abc.Callable
.
So far I haven't use the collections.abs module but I wonder if typing.Callable
might be related to collections.abc.Callable
therefore making the Callable
type hint deprecated, too.
I did try this:
def my_function(argument_function: callable) -> None:
And it works.
But is that really the correct way now?
Or Do I still have to import typing.Callable
?