You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, I am not sure that this is an issue in vscode-python and not in some other part of VSCode but I don't know how to understand which component is responsible - please point me in the right direction.
Consider this example
defis_even(x: int) ->bool:
'''Returns True if x is even, False otherwise'''returnx%2==0print(is_even(2))
Pointing to is_even(2) call shows a tooltip with function prototype and documentation
Now we add lru_cache
importfunctools@functools.cachedefis_even(x: int) ->bool:
'''Returns True if x is even, False otherwise'''returnx%2==0print(is_even(2))
and it still shows that is_even is a function but prototype changes to _lru_cache_wrapper[bool] and doc-string is gone
Python 3.12 help() output is
Help on function is_even in module __main__:
is_even(x: int) -> bool
Returns True if x is even, False otherwise
without lru_cache and
Help on _lru_cache_wrapper in module __main__:
is_even(x: int) -> bool
Returns True if x is even, False otherwise
with it.
So, while it is helpful to see that the function is wrapped in lru_cache, it would also be nice to see proper argument list and documentation.
The text was updated successfully, but these errors were encountered:
See this issue for information about why pyright (the static type analysis engine upon which pylance is based) behaves as it does in this case. It's due to the way that functools.cache and functools.lru_cache are defined in the typeshed stubs. A change in behavior here would require a modification to the typeshed stubs. There are some tradeoffs for this change, however. Because of this, the maintainers of typeshed have been reluctant to accept a change. If you have an opinion on the matter, I recommend posting in the typeshed thread.
First of all, I am not sure that this is an issue in vscode-python and not in some other part of VSCode but I don't know how to understand which component is responsible - please point me in the right direction.
Consider this example
Pointing to
is_even(2)
call shows a tooltip with function prototype and documentationNow we add
lru_cache
and it still shows that
is_even
is a function but prototype changes to_lru_cache_wrapper[bool]
and doc-string is gonePython 3.12
help()
output iswithout lru_cache and
with it.
So, while it is helpful to see that the function is wrapped in lru_cache, it would also be nice to see proper argument list and documentation.
The text was updated successfully, but these errors were encountered: