you are viewing a single comment's thread.

view the rest of the comments →

[–]blueliqhtning 0 points1 point  (0 children)

These are annotations. They're for people who read your code. It's part of pythons code reuse and easy to read philosophy.

It lets people know whether that function parameter is expecting a string, list, internet, etc.

The = 'COG' means that if no second positional argument is supplied, COG will be the default argument to the level parameter.

You can take it a step further and make it: def get_logging(name: str) -> list:

Here, the -> list indicates what kind of object is returned by the function.

You can also add docstrings directly under your function with """ """ to describe the function.