two python scripts behave differently when use different name for a user defined class
<p>I am learning python. I encounter a strange problem. I create a class named "test" with serveral member functions and all is fine. However, when I substitude the class name to "test1", it goes wrong. I used vimdiff, diff and beyond compare to verify the two files, and see only the class name is different.</p>

<p>Here is the first script:</p>

<pre><code>#!/usr/bin/python
#Filename: objvar.py

class test:
  '''Represents a person.'''
  population = 0
  def __init__(self, name):
    '''Initializes the person's data'''
    self.name = name
    print "(Initializing%s)"% self.name
    test.population += 1

  def __del__(self):
    '''I am dying'''
    print "%s says bye."% self.name
    test.population -= 1
    if test.population == 0:
      print "I am the last one."
    else:
      print "There are still %d people left."% test.population
  def sayHi(self):
    '''Greeting by the person.
    Really, that's all it does'''
    print "Hi, my name is %s."% self.name
  def howMany(self):
    '''Prints the current population.'''
    if test.population == 1:
      print "I am the only person here"
    else:
      print "We have%dpersons here."% test.population
ada = test("ada")
ada.sayHi()
ada.howMany()

yuwenlong = test("yuwenlong")
yuwenlong.sayHi()
yuwenlong.howMany()

ada.sayHi()
ada.howMany()
</code></pre>

<p>When it runs, the result is:</p>

<pre><code>(Initializingada)
Hi, my name is ada.
I am the only person here
(Initializingyuwenlong)
Hi, my name is yuwenlong.
We have2persons here.
Hi, my name is ada.
We have2persons here.
yuwenlong says bye.
There are still 1 people left.
ada says bye.
I am the last one.
</code></pre>

<p>And here is the second script:</p>

<pre><code>#!/usr/bin/python
#Filename: objvar.py

class test1:
  '''Represents a person.'''
  population = 0
  def __init__(self, name):
    '''Initializes the person's data'''
    self.name = name
    print "(Initializing%s)"% self.name
    test1.population += 1

  def __del__(self):
    '''I am dying'''
    print "%s says bye."% self.name
    test1.population -= 1
    if test1.population == 0:
      print "I am the last one."
    else:
      print "There are still %d people left."% test1.population
  def sayHi(self):
    '''Greeting by the person.
    Really, that's all it does'''
    print "Hi, my name is %s."% self.name
  def howMany(self):
    '''Prints the current population.'''
    if test1.population == 1:
      print "I am the only person here"
    else:
      print "We have%dpersons here."% test1.population
ada = test1("ada")
ada.sayHi()
ada.howMany()

yuwenlong = test1("yuwenlong")
yuwenlong.sayHi()
yuwenlong.howMany()

ada.sayHi()
ada.howMany()
</code></pre>

<p>When I run this one, the result is:</p>

<pre><code>(Initializingada)
Hi, my name is ada.
I am the only person here
(Initializingyuwenlong)
Hi, my name is yuwenlong.
We have2persons here.
Hi, my name is ada.
We have2persons here.
yuwenlong says bye.
Exception AttributeError: "'NoneType' object has no attribute 'population'" in &lt;bound method test1.__del__ of &lt;__main__.test1 instance at 0xb7ece0ec&gt;&gt; ignored
ada says bye.
Exception AttributeError: "'NoneType' object has no attribute 'population'" in &lt;bound method test1.__del__ of &lt;__main__.test1 instance at 0xb7ece0cc&gt;&gt; ignored
</code></pre>

<p>Would someone tell why the second script failed with just a different class name in the script text? My pyhton version is Python 2.7.2.</p>
