class Person: """ People with names. """ population = 0 def __init__(self, name="John Smith"): self.name = name Person.population = Person.population + 1 def get_name(self): return self.name def set_name(self, newname): self.name = newname def __str__(self): return "Person: " + self.name def main(): fred = Person("Fred") sally = Person("Sally") generic = Person() print fred print sally print generic generic.set_name("Bill") print "new name: " + str(generic) print "total population is " + str(Person.population) main()