def quantity():  # <1>
    try:
        quantity.counter += 1  # <2>
    except __HOLE__:
        quantity.counter = 0  # <3>

    storage_name = '_{}:{}'.format('quantity', quantity.counter)  # <4>

    def qty_getter(instance):  # <5>
        return getattr(instance, storage_name)

    def qty_setter(instance, value):
        if value > 0:
            setattr(instance, storage_name, value)
        else:
            raise ValueError('value must be > 0')

    return property(qty_getter, qty_setter)
# END LINEITEM_V4_PROP
dataset/ETHPy150Open fluentpython/example-code/20-descriptor/bulkfood/bulkfood_v4prop.py/quantity