Oct-22-2019, 11:58 PM
(Oct-22-2019, 02:08 PM)ichabod801 Wrote:PEP 3107 Wrote:All annotation expressions are evaluated when the function definition is executed, just like default values.This all seems consistent with PEP 3107. Annotations are expressions which are evaluated. In order to evaluate anything in Python, all the names must be defined. This precludes circular annotations like you are trying to do.
Thanks for your advice, but this type of circular reference is valid requirement, right? eg. two type of classes with parent and child relation. In other static languages, with type definition in advance, there is no any problem. On another hand, In above case that I showed, python allows circular reference inside function and it works without function annotation, but it's not allowed in function annotation, which will limit the usage of function annotation, do you have any solution except python 2 style type remarks which I used now?