How I can tell with Docstring
to PyCharm that return type is the list of SomeClass
instances?
Tried out: @rtype [SomeClass]
, but it acts only as list
.
Press Ctrl+Space or choose Code | Code Completion | Basic from the main menu. If necessary, press Ctrl+Space for the second time (or press Ctrl+Alt+Space ).
Type hints validation Any time you're applying type hints, PyCharm checks if the type is used correctly according to the supported PEPs. If there is a usage error, the corresponding warning is shown and the recommended action is suggested.
By default, PyCharm shows all classes, methods, and other elements of the current file. To toggle the elements you want to show, click the corresponding buttons on the Structure tool window toolbar.
Enabling/Disabling Auto-complete While typing your code in the editor: Press CTRL + Space key to trigger the auto-complete pop-up menu manually.
def do_something():
"""
@rtype: list of SomeClass
"""
pass
Works well, interprets return value as list and autocompletes SomeClass
methods when accessing list
element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With