OK, I missed out on typing-...@python.org, and now I know this thread is 
off-topic on python-dev@python.org.

A bit more clear example of what I want to do is:

```
class Field:
  def __init__(self, desc: str) -> None:
    self.desc = desc


class FooMetaType:
  variable_both_class_and_instance: Field

  def __call__(self, value: int) -> 'Foo':
    ...


class Foo:
  variable_both_class_and_instance: int

  def __init__(self, value: int) -> None:
    self.variable_both_class_and_instance = value

Foo: FooMetaType
Foo.variable_both_class_and_instance = Field(desc="descriptive string")

instance = Foo(5)

print(instance.variable_both_class_and_instance)
```

Static typing on this example doesn't work correctly as expected because it 
does not allow overwriting another type over a class declaration.

My point on the example is the tangible value should be assigned to the 
instance variables. Still, on the other hand, I want to give a value denoting 
the variable's metadata to the class variable. From my understanding, these 
variables, like this `variable_both_class_and_instance` in the example, cannot 
be correctly typed.

Thank you for your kindness, I'll repost it to typing-...@python.org.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/IDV7E26G4SDUNEGCMFAAMXLO52YQNOPE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to