This is an example from the book "Python In a Nutshell, 3rd ed."
class Const(object):
def __init__(self, value):
self.value = value
def __set__(self, *_):
pass
def __get__(self, *_):
return self.value
class X(object):
c = Const(23)
x=X()
type(x.c)
>>>> <class 'int'>
c = Const(32)
type(c)
>>>> <class '__main__.Const'>
Why is the data type of the x.c Integer?
Also, why doesn't the set override descriptor work for c?,
c.value
>>>> 32
c.value = 1
c.value
>>>> 1
It works on the x.c instance
x.c = 1
x.c
>>>> 23