Avatar ·

Comment créer une propriété statique de classe en Python ?

📁 Sujets avancés sur Python, erreur

J'essaie ceci :

  class ChatCodes: _chat = 'CHT' @property def chat(self): return self._chat  

si j'utilise ceci :

  print(ChatCodes.chat + 'ANY_STR')  

alors une erreur apparaît :

unsupported operand type(s) for +: 'property' and 'str'

Comment créer une propriété statique ?