0

I've been coding in python for quite a while but I came across a piece of code which got me really confused, as I've never seen expressions like this before:

class A(object):

    def __init__(self, config:dict, pool_args: dict=None, background: bool=True, **kwargs):
         self._config = config
         self._pool_args = pool_args
          ...

so what is this type of syntax: config:dict and pool_args: dict=None inside the function argument brackets?
Are they used often? I've really never seen this before.

Kid_Learning_C
  • 2,605
  • 4
  • 39
  • 71

1 Answers1

1

These are type hints. See this for more details: https://www.python.org/dev/peps/pep-0484/

davejagoda
  • 2,420
  • 1
  • 20
  • 27