The string representation of a function signature with annotations is currently like this: >>> def __init__(self, x: int = 1, y: int = 2) -> None: pass ... >>> import inspect >>> str(inspect.signature(__init__)) '(self, x:str=1, y:int=2) -> None' At the same time PEP 8 says: When combining an argument annotation with a default value, use spaces around the = sign (but only for those arguments that have both an annotation and a default). Yes: def munge(sep: AnyStr = None): ... def munge(input: AnyStr, sep: AnyStr = None, limit=1000): ... No: def munge(input: AnyStr=None): ... def munge(input: AnyStr, limit = 1000): ... I think there should be spaces in the signature repr.
FWIW, I find the version without the spaces to be more readable (but I don't find annotations to be readable in general, so my opinion may not be worth much :)
Those people who read and write annotations regularly are all using the convention that was added to PEP 8, so let's make inspect follow that lead rather than argue about it here. :-)