10000 Allow variables inside isinstance by pkch · Pull Request #3070 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Allow variables inside isinstance #3070

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

Merged
merged 3 commits into from
Apr 3, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix TODOs in binder.py
  • Loading branch information
pkch committed Mar 28, 2017
commit 0f06e06f3ffe80f1589d09b9834997569cb7ba67
6 changes: 2 additions & 4 deletions mypy/binder.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ def _get(self, key: Key, index: int=-1) -> Type:
return None

def put(self, expr: Expression, typ: Type) -> None:
# TODO: replace with isinstance(expr, BindableTypes)
if not isinstance(expr, (IndexExpr, MemberExpr, NameExpr)):
if not isinstance(expr, BindableTypes):
return
if not expr.literal:
return
Expand Down Expand Up @@ -203,8 +202,7 @@ def assign_type(self, expr: Expression,
type: Type,
declared_type: Type,
restrict_any: bool = False) -> None:
# TODO: replace with isinstance(expr, BindableTypes)
if not isinstance(expr, (IndexExpr, MemberExpr, NameExpr)):
if not isinstance(expr, BindableTypes):
return None
if not expr.literal:
return
Expand Down
0