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.
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.
OR (|) operator on type annotations
We can use Union for this.
In addition, Optional seems useful for Union with None.
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.
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.
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.
OR (
|
) operator on type annotations We can useUnion
for this. In addition,Optional
seems useful forUnion
withNone
.list
,dict
,tuple
, etc. In the old versions, we can useList
,Dict
,Tuple
, etc. instead.This will be applied in #80. See also #78 and #84.