class myint int pass class Desc object def __init__ self self num myin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class myint(int):
pass
class Desc(object):
def __init__(self):
self.num = myint(0)
def __get__(self, instance, instance_type=None):
return getattr(instance, '_x', myint(0))
def __set__(self, instance, value):
setattr(instance, '_x', myint(value))
class WithDesc(object):
x = Desc()