Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue32018

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:inspect.signature does not respect PEP 8
Type:behaviorStage:resolved
Components:Versions:Python 3.7
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: corona10, eric.smith, gvanrossum, levkivskyi, r.david.murray, yselivanov
Priority:normalKeywords:patch

Created on2017-11-13 22:06 bylevkivskyi, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 4408mergedcorona10,2017-11-15 17:36
Messages (6)
msg306171 -(view)Author: Ivan Levkivskyi (levkivskyi)*(Python committer)Date: 2017-11-13 22:06
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 timePEP 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.
msg306172 -(view)Author: R. David Murray (r.david.murray)*(Python committer)Date: 2017-11-13 22:11
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 :)
msg306174 -(view)Author: Guido van Rossum (gvanrossum)*(Python committer)Date: 2017-11-13 22:49
Those people who read and write annotations regularly are all using the convention that was added toPEP 8, so let's make inspect follow that lead rather than argue about it here. :-)
msg306175 -(view)Author: R. David Murray (r.david.murray)*(Python committer)Date: 2017-11-13 22:53
Agreed.
msg306295 -(view)Author: Dong-hee Na (corona10)*(Python committer)Date: 2017-11-15 18:25
I've submitted a patch. :)
msg306296 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2017-11-15 18:31
New changeset762b9571c9c8c6b036f1bf90140a1d030b3f9a01 by Yury Selivanov (Dong-hee Na) in branch 'master':bpo-32018: Fix inspect.signature repr to followPEP 8 (#4408)https://github.com/python/cpython/commit/762b9571c9c8c6b036f1bf90140a1d030b3f9a01
History
DateUserActionArgs
2022-04-11 14:58:54adminsetgithub: 76199
2017-11-15 18:31:22yselivanovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-11-15 18:31:06yselivanovsetmessages: +msg306296
2017-11-15 18:25:51corona10setmessages: +msg306295
2017-11-15 17:46:28corona10setnosy: +corona10
2017-11-15 17:36:41corona10setkeywords: +patch
stage: patch review
pull_requests: +pull_request4357
2017-11-13 22:53:52r.david.murraysetmessages: +msg306175
2017-11-13 22:49:59gvanrossumsetnosy: +gvanrossum
messages: +msg306174
2017-11-13 22:36:06eric.smithsetnosy: +eric.smith
2017-11-13 22:11:27r.david.murraysetnosy: +r.david.murray
messages: +msg306172
2017-11-13 22:06:50levkivskyicreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp