Menu

#1316 Local imports do not work for code completion type hinting

open
5
2011-04-14
2011-04-14
Ryan Seiff
No

Using assert isinstance(X, Y) does not work for a type Y that was imported into a local scope. For example, the following does not give the variable "param" code complete options:

def foo(param):
import weakref
assert isinstance(param, weakref.ReferenceType)
param.

To contrast, the following DOES work:

import weakref
def foo(param):
assert isinstance(param, weakref.ReferenceType)
param.

It is expected that both code blocks above cause code completion to work.

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.