-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Full signature for namedtuple #541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
# NamedTuple is special-cased in the type checker; the initializer is ignored. | ||
def NamedTuple(typename: str, fields: Iterable[Tuple[str, Any]], *, | ||
verbose: bool = ..., rename: bool = ..., module: str = None) -> Type[tuple]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fields
can be more exact as Iterable[Tuple[str, Union[str, Type]]]
or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, a type annotation doesn't have to be a type (see python/typing#136). So better leave this as is, or use Union[str, Any].
( |
Can you also do these for 2.7? Also, please be careful about not adding extra blank lines (read your own review to find where they are). |
# NamedTuple is special-cased in the type checker; the initializer is ignored. | ||
def NamedTuple(typename: str, fields: Iterable[Tuple[str, Any]], *, | ||
verbose: bool = ..., rename: bool = ..., module: str = None) -> Type[tuple]: ... | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kill this blank line please.
There's also 2.7/typing.pyi. |
Fingers crossed! |
Issue #533