If you have only one instance anyway, it’s best to make all variables per-instance, simply because they will be accessed (a little bit) faster (one less level of “lookup” due to the “inheritance” from class to instance), and there are no downsides to weigh against this small advantage.
More Related Contents:
- Should I use instance or class attributes if there will only be one instance? [closed]
- Static class variables and methods in Python
- How would I access variables from one class to another?
- What is the difference between class and instance variables?
- python class instance variables and class variables
- Getting an instance name inside class __init__() [duplicate]
- class variables is shared across all instances in python? [duplicate]
- Class (Static) variables and methods in Python
- How to force/ensure class attributes are a specific type?
- Class (static) variables and methods
- How to declare a static attribute in Python?
- How to print instances of a class using print()?
- Getting the name of a variable as a string
- How to use a variable inside a regular expression?
- Convert Variable Name to String?
- If two variables point to the same object, why doesn’t reassigning one variable affect the other?
- Keep persistent variables in memory between runs of Python script
- How to create module-wide variables in Python? [duplicate]
- Assigning (instead of defining) a __getitem__ magic method breaks indexing [duplicate]
- Tkinter example code for multiple windows, why won’t buttons load correctly?
- What is the purpose of the `self` parameter? Why is it needed?
- difference between variables inside and outside of __init__() (class and instance attributes)
- Define a method outside of class definition?
- Python super method and calling alternatives
- Is there a way to circumvent Python list.append() becoming progressively slower in a loop as the list grows?
- How to assign a new class attribute via __dict__?
- Get name of current class?
- “Enabling” comparison for classes [duplicate]
- Dynamically creating classes – Python
- How to find instance of a bound method in Python?