I recently hit this issue working on a config/parsing runtime type checking library (similar in spirit to pydantic).
The one other special typeform I was using these with that led me to discover this issue was Annotated. I use Annotated a fair amount to do some runtime analysis and I was used to `Annotated[typeform]` always works. But ClassVar and Final are special and `Annotated[ClassVar[...]] `and `Annotated[Final[...]]` both fail. I find `Annotated` interaction also weird. I ended up working around it by doing `ClassVar[Annotated[...]]` and stripping the classvar/final to look for the annotation metadata.
I think all 3 of annotated/final/classvar should be order compatible as they all serve to add information on the type they contain.
If we ignore Annotated, I would say ClassVar/Final should be order compatible and a rule that Final[ClassVar[...]] works but not ClassVar[Final[...]] or vice versa would be weird. |