This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author levkivskyi
Recipients levkivskyi, yselivanov
Date 2017-11-13.22:06:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1510610810.77.0.213398074469.issue32018@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-11-13 22:06:50levkivskyisetrecipients: + levkivskyi, yselivanov
2017-11-13 22:06:50levkivskyisetmessageid: <1510610810.77.0.213398074469.issue32018@psf.upfronthosting.co.za>
2017-11-13 22:06:50levkivskyilinkissue32018 messages
2017-11-13 22:06:50levkivskyicreate