My question is simple: How can I add properties and setter to classmethod ?
Here is my code:
class Ingredient():
     __max_stock = 100
     __stock = 0
     __prix = 0
     def __init__(self):
         pass
     @classmethod
     @property
     def prix(cls):
         return cls.__prix
     @classmethod
     @prix.setter
     def prix(cls, value):
         assert isinstance(value, int) and int(abs(value)) == value
         cls.__prix = value
Ingredient.prix = 10        #should be OK
Ingredient.prix = 'text'    #should raise an error
Ingredient.prix = 10.5      #should raise an error too
Problem is that the setter doesn't work when the var is a class variable. Here is the error I get :
AttributeError: 'classmethod' object has no attribute 'setter'
I use Python 3.x
 
     
     
    