from functools import partial
writeonly_prop=partial(property, None)
class Test:
@writeonly_prop
def secret(self, val):
self.__value = val
def print_secret(self):
print(self.__value)
def __init__(self):
self.__value = None
t = Test()
t.secret = 12
t.print_secret()