0

what is the meaning of the following command:

def run_initial(self) -> object:

I don't know why he put object after the arrow. What is the meaning of the object here?

Barmar
  • 741,623
  • 53
  • 500
  • 612

2 Answers2

1

They are type annotations.

Type annotations are type hints that were brought in with pep-0484. They were made to allow developers to use third party tools or modules that consume these to give more information to the user about types for example.

The more obvious use case imho right now is that the Python visual editor PyCharm (which is afaik the most used pycharm editor after sublime, which is not a complete editor) supports them to give programmers information about types, and for auto complete.

See https://www.jetbrains.com/help/pycharm/2016.1/type-hinting-in-pycharm.html

Jules G.M.
  • 3,624
  • 1
  • 21
  • 35
0

It's a Type aliases.They were added in pep-404.

Straight from the Python docs:

A type aliases is defined by assigning the type to the alias...Type aliases are useful for simplifying complex type signatures...Note that None as a type hint is a special case and is replaced by type(None).

Christian Dean
  • 22,138
  • 7
  • 54
  • 87