Reputation: 459
I'm using the PyCharm Community Edition on development.
I know I can use python docstrings to set a return with :rtype:.
But how can I tell that a method returns a list with specific objects type and then be able to use autocomplete after that.
class MyObject:
def method_1(self):
do_something()
def method_2(self):
do_something()
class ReturnListOfObjects:
def return_list_of_MyObjects():
"""
:rtype: (here I usually put just list, but can not use autocomplete after)
"""
Upvotes: 1
Views: 85
Reputation: 11916
According to this link - https://www.jetbrains.com/pycharm/help/type-hinting-in-pycharm.html#d314357e162, it should be:
list[MyObject]
Upvotes: 1