Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm autocomplete, list of types

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.

like image 907
fedosov Avatar asked Aug 06 '12 09:08

fedosov


People also ask

How do you autocomplete in PyCharm?

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 ).

Does PyCharm have a type checker?

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.

How can I see all functions in PyCharm?

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.

What should you type to open up the autocomplete menu while you code?

Enabling/Disabling Auto-complete While typing your code in the editor: Press CTRL + Space key to trigger the auto-complete pop-up menu manually.


1 Answers

def do_something():
    """
    @rtype: list of SomeClass
    """
    pass

Works well, interprets return value as list and autocompletes SomeClass methods when accessing list element.

like image 80
fedosov Avatar answered Sep 28 '22 10:09

fedosov