8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
We may want to support code like this, since this style of creating dictionaries seems pretty common:
X = TypedDict('X', {'n': int, 'status': str}) def f() -> X x = {} # type: X x['n'] = 3 if cond(): x['status'] = 'yes' else: x['status'] = 'no' return x
We could perhaps use partial types and the conditional type binder for this. The type of x would be partial until all items have been set.
x
This code would be rejected, since x is still partial when we read it:
def f() -> X: x = {} # type: X x['n'] = 3 if cond(): x['status'] = 'yes' return x # error: "status" of "x" may be undefined
The text was updated successfully, but these errors were encountered:
This seems too complicated to implement relative to the potential benefit.
Sorry, something went wrong.
No branches or pull requests
We may want to support code like this, since this style of creating dictionaries seems pretty common:
We could perhaps use partial types and the conditional type binder for this. The type of
x
would be partial until all items have been set.This code would be rejected, since
x
is still partial when we read it:The text was updated successfully, but these errors were encountered: