What Does : Mean in Python? (NOT IN A LIST)

Viewed 61

I saw this code in the internet and I'm wounding what's : in this code?

dispatcher : Dispatcher = Updater.dispatcher
1 Answers

It's type-hinting.

https://docs.python.org/3/library/typing.html

It helps the coder know what the object's intended type is. Also, some linter will shows error if you try to invoke some unsupported methods of a class object, similar to a static compiler.

Related