I am trying to make a class in Python with static variables and methods (attributes and behaviors)
import numpy
class SimpleString():
popSize = 1000
displaySize = 5
alphatbet = "abcdefghijklmnopqrstuvwxyz "
def __init__(self):
pop = numpy.empty(popSize, object)
target = getTarget()
targetSize = len(target)
When the code runs though it says that it cannot make the array pop because popSize is not defined
self
, e.g.,self.popSize
. – BrenBarn Nov 14 '13 at 18:44SimpleString.popSize
.... when it is static class variable ... (if you access it with self changes will not reflect back to the classvariable) – Joran Beasley Nov 14 '13 at 18:48