![](https://secure.gravatar.com/avatar/fad813297602a7b716141745ad91b151.jpg?s=120&d=mm&r=g)
26 Dec
2017
26 Dec
'17
7:02 a.m.
Well, I fact, I was playing with metaclasses and descriptors, and I was thinking about a way to use the famous variable annotation to instatiate decrptors like this: class Point(metaclass=MyMeta): x: int y: int class Circle(metaclass=MyMeta): center: Point radius: PositiveInteger Here the radius must be [strictly] positive, but since I'm using the annotations to get the type to test in the __set__ method of the descriptor, I didn't found a more elegant way than that... And it was before I knew the existance of dataclasses!!! I was pretty shocked by the way. Maybe I can make this compatible with it anyway.