How to tell PyCharm what is the type of the variable
def any_function_or_method(some_item):
assert isinstance(some_item, SomeItem)
# Now type `some_item.`
An assert
line here will tell PyCharm the type of some_item
variable and use this information for autocomplete suggestions.
Written by Vladimir Prudnikov
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#