I searched a lot for static variables in python but could not find a direct answer . Just as java would have a variable defined as static within a class , can the same be done for python?
Asked
Active
Viewed 1,831 times
2 Answers
0
For using static variable you have to use it inside class.
class XYZ:
value = 3
print(MyClass.value) // access it via class name

Jitesh Mohite
- 31,138
- 12
- 157
- 147