When one needs a custom property, the easy, readable, and that already works way to create then
is just to create an instance of the their class and assign the instance to the desired
class attribute. All the class have to do is to have the methods that identify it as a descriptor: "__get__" and "__set__" for
data descriptors , and optionally "__del__".
The class can be made in a way to make it easier to write the setters and getter , and have
their "__set__" and "__get__" call these other methods, but that is about it.
```
class ThresholdProperty:
def __init__(self, threshold=0.5):
self.threshold = threshold
def __set_name__(self, owner, name):
def __set__(self, instance, value):
self.instance.setattr("_" +
self.name, value)
def __get__(self, instance, owner):
if instance is None: return self
return int(getattr(instance, "_" +
self.name) > self.threshold)
class Neuron:
activation = ThresholdProperty()
```