+ 1
How do I create class attributes in Python?
I wanted to create a class attributes, that doesn't belong to the class objects (static attributes), how can I do that?
3 Respuestas
+ 4
The beginning of your code can be like this:
class Myclass:
Attribute1 = value1
Attribute2 = value2
def __ init__(self):
...
+ 2
Seb TheS you can achieve that by magic methods like this code:
https://code.sololearn.com/cLpCdHaqlb0d/?ref=app
0
@Qasem Yes, but I don't want those attributes to be shared with the objects