title: python define object with same name
body: <p>I am not sure why the outcome is this one for the following example, and explanation on what is happening is appreciated!</p>
  <p>Define the following class in Python:</p>
  <pre><code>class Person:
      population = 0
      
      def __init__(self, name):
          self.name = name
          print ('Initializing %s' % self. name)
          
          Person.population += 1
          
      def __del__(self):
          print  ('%s says bye' % self.name)
          
          Person.population -= 1
          
          if Person.population == 0:
              print ('I am the last one')
          else:
              print ('there are still %d people left' % Person.population)
          
      def sayHi(self):
          print (&quot;Hi, my name is %s&quot; % self.name)
          
      def howMany(self):
          print ('We have %d persons here' % Person.population)
  </code></pre>
  <p>When I do the following for the first time</p>
  <pre><code>p1 = Person('p1')
  </code></pre>
  <p>I got</p>
  <pre><code>Initializing p1
  </code></pre>
  <p>This makes sense,</p>
  <p>but if I call this again</p>
  <pre><code>p1 = Person('p1')
  </code></pre>
  <p>I got the following that I don't understand</p>
  <pre><code>Initializing p1
  p1 says bye
  there are still 1 people left
  </code></pre>
  <p>If I call this</p>
  <pre><code>p1 = Person('p2')
  </code></pre>
  <p>I have</p>
  <pre><code>Initializing p2
  </code></pre>
  <p>and I have 2 persons by call</p>
  <pre><code>p1.howMany()
  </code></pre>
  <p>I am not sure what is happening.</p>