print object/instance name in python
<p>I was wondering if there is a way to print the object name in python as a string.  For example I want to be able to say ENEMY1 has 2 hp left or ENEMY2 has 4 hp left.  Is there a way of doing that?\</p>

<pre><code>class badguy:
    def __init__(self):
        self.hp = 4

    def attack(self):
        print("hit")
        self.hp -= 1

    def still_alive(self):
        if self.hp &lt;=0:
            print("enemy destroyed")
        else :
            print (str(self.hp) + " hp left")

    # creating objects

    enemy1 = badguy()
    enemy2 = badguy()

    enemy1.attack()
    enemy1.attack()
    enemy1.still_alive()
    enemy2.still_alive()
</code></pre>