Avatar ·

كيفية إنشاء خاصية ثابتة (static property) للفئة في Python؟

📁 بايثون, خطأ

أحاول هذا:

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

إذا استخدمت هذا:

print(ChatCodes.chat + 'ANY_STR')

يظهر خطأ:

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

كيف يمكن إنشاء خاصية ثابتة (static property)؟