mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 12:14:27 +08:00
Function bodies should be empty (#959)
I've seen some stubs like
```
class X:
def __init__(self, x: str) -> None:
self.x = x
self.y = 0
```
I think this should be written instead as
```
class X:
x: str
y: int
def __init__(self, x: str) -> None: ...
```
This commit is contained in:
committed by
Guido van Rossum
parent
bd5b33f3b1
commit
d04b9b204e
@@ -127,6 +127,7 @@ Style conventions for stub files are different from PEP 8. The general
|
||||
rule is that they should be as concise as possible. Specifically:
|
||||
* there is no line length limit;
|
||||
* prefer long lines over elaborate indentation;
|
||||
* all function bodies should be empty;
|
||||
* prefer ``...`` over ``pass``;
|
||||
* prefer ``...`` on the same line as the class/function signature;
|
||||
* avoid vertical whitespace between consecutive module-level functions,
|
||||
|
||||
Reference in New Issue
Block a user