canonical / is-charms-contributing-guide

The code contributing guide for the IS charms team
Apache License 2.0
2 stars 1 forks source link

Type hints #11

Closed jdkandersson closed 1 year ago

jdkandersson commented 2 years ago

Type hints are helpful:

There are a range of type hint levels we could adopt:

  1. No type hints
  2. Some type hints, e.g., for key functions and class/ instance variables
  3. Use type hints extensively except where it is impractical to do so

To gain the maximum advantage of type hints and for code correctness to enhance stability of charms, I would recommend we go for (3).

merkata commented 2 years ago

Type hints are helpful:

  • When editing code as many code editors will use type hints for auto completion and indicating problems
  • Make it easier to understand the code
  • Can use mypy to statically check whether all types are correctly being used, e.g., for function parameters

There are a range of type hint levels we could adopt:

  1. No type hints
  2. Some type hints, e.g., for key functions and class/ instance variables
  3. Use type hints extensively except where it is impractical to do so

To gain the maximum advantage of type hints and for code correctness to enhance stability of charms, I would recommend we go for (3).

+1 for option (3)!