반응형
해결 방법
일부 도구는 Python 2.7과 호환되어야하는 코드에서 유형 주석을 지원할 수 있습니다. 이를 위해이 PEP에는 함수 주석이 # 유형 : 주석에 배치되는 제안 된 (필수는 아님) 확장이 있습니다. 이러한 주석은 함수 헤더 바로 뒤에 (독 스트링 앞) 배치해야합니다. 예 : 다음 Python 3 코드 :
def embezzle(self, account: str, funds: int = 1000000, *fake_receipts: str) -> None: """Embezzle funds from account using fake receipts.""" <code goes here>
다음과 같습니다.
def embezzle(self, account, funds=1000000, *fake_receipts): # type: (str, int, *str) -> None """Embezzle funds from account using fake receipts.""" <code goes here>
참조 페이지 https://stackoverflow.com/questions/35230635
반응형
'파이썬' 카테고리의 다른 글
파이썬 Add another tuple to a tuple of tuples (0) | 2020.11.09 |
---|---|
파이썬 Python string.replace ()가 문자를 대체하지 않음 (0) | 2020.11.09 |
파이썬 Enter를 누르지 않고 파이썬에서 raw_input (0) | 2020.11.09 |
파이썬 How to check if all values of a dictionary are 0 (0) | 2020.11.09 |
파이썬 Tensorflow Tensorboard 기본 포트 (0) | 2020.11.09 |
댓글