F
futileissue
Beginner, so please bare with me. I'm not sure what to call what it
is I'm looking for.
If I have an object class, let's call it "Creature":
class Creature:
def __init__(self, status):
self.status = "happy"
def change_status(self, new_status):
self.status = new_status
def print_status(self):
print self.status
I would like to be able to print out the Creature's status every 20
seconds. Let's say I use a script like this:
import time
while True:
time.sleep(20)
Creature.print_status()
But, while cycling through printing the status, I would like to be
able to update Creature.status to something new.
I might be approaching this from the wrong direction entirely. Thanks
for your input.
is I'm looking for.
If I have an object class, let's call it "Creature":
class Creature:
def __init__(self, status):
self.status = "happy"
def change_status(self, new_status):
self.status = new_status
def print_status(self):
print self.status
I would like to be able to print out the Creature's status every 20
seconds. Let's say I use a script like this:
import time
while True:
time.sleep(20)
Creature.print_status()
But, while cycling through printing the status, I would like to be
able to update Creature.status to something new.
I might be approaching this from the wrong direction entirely. Thanks
for your input.