[Tutor] class (or static) variable?

Thomas Rivas trivas7@rawbw.com
Sat Apr 12 23:36:04 2003


Hello--

Is MyClass.item in the following an example of a class (Java/C++ 'static')
variable?

#!/bin/env python
class MyClass:
        item=42
        def __init__(self):
                self.item = 24
        def __str__(self):
                return str(self.item)
x=MyClass()
print x.item
print x
print MyClass.item
# prints:
# 24
# 24
# 42

Thanks,

Tom
--
I like Boolean logic. NOT