+ 1

How can we initalize static variable in python?

21st Jul 2017, 8:47 PM
Kailash Prasad
Kailash Prasad - avatar
2 odpowiedzi
+ 7
class Animal: species = 100 def method1(self, c): pass def method2(self, d): pass # Any variable declared inside a class but not within any of its methods is a class (or static) variable. >>> Animal.count 100
21st Jul 2017, 9:13 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
Can you give us an example of what you want to do?
22nd Jul 2017, 10:24 AM
Hymn
Hymn - avatar