snu-quiqcl / qiwis

QuIqcl Widget Integration Software
MIT License
6 stars 2 forks source link

Old version compatible type annotation #89

Closed kangz12345 closed 1 year ago

kangz12345 commented 1 year ago

Since the type annotation syntax is quite new in Python, we have troubles using the latest type annotation syntax. Since we use Python 3.8-3.10 for Pylint checking, we should support at least Python 3.8. Moreover, since our main computer in the lab is using Python 3.7, it seems better to support Python 3.7 as well.

  1. Forward references If we use the type that is not defined yet, e.g., in the class definition itself, we cannot use the class name as a type since it is not defined. In that case, we use a string literal as you see in the linked reference.

  2. OR (|) operator on type annotations We can use Union for this. In addition, Optional seems useful for Union with None.

  3. list, dict, tuple, etc. In the old versions, we can use List, Dict, Tuple, etc. instead.

This will be applied in #80. See also #78 and #84.