Hello folks, I am Chihiro, a.k.a. Frodo821, and this is my first post to this group.
I searched for a way to annotate both class variables and instance variables with different types and concluded that there is currently no way to do this.
For example, what I want to:
```
class Foo:
variable_both_class_and_instance = Field(desc="descriptive string")
def __init__(self, value: int):
self.variable_both_class_and_instance = value
assert isinstance(Foo.variable_both_class_and_instance, Field)
assert isinstance(Foo().variable_both_class_and_instance, int)
```
In this example, I want to annotate `Foo.variable_both_class_and_instance` with `Field` when it is accessed as a class variable. On the other hand, I want to annotate `Foo.variable_both_class_and_instance` with `int` when it is accessed as an instance variable.
I don't have any smart ideas to accomplish this, but I think `typing.ClassVar` could be extended this like:
```
class Foo:
variable_both_class_and_instance: Union[ClassVar[Field], int] = Field(desc="descriptive string")
def __init__(self, value: int):
self.variable_both_class_and_instance = value
assert isinstance(Foo.variable_both_class_and_instance, Field)
assert isinstance(Foo().variable_both_class_and_instance, int)
```
Do you have any ideas or comments about this?