Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Unique:
- def _init__(self):
- self.__class__._counter += 1
- self._id_num = self.__class__._counter # I'm trying to have a counter for each subclass
- self._type_name = self.__class__.__name__
- def __str__(self):
- return '{0} #{1}'.format(self._type_name, self._id_num)
- def log(self, *data):
- print('[{0}]'.format(self), *data)
- @property
- def id_num(self):
- return self._id_num
- class Job(Unique):
- def __init__(self):
- super().__init__()
- def run(self):
- self.log('Started')
- def poll(self):
- ''' Returns `None` if the job is still running
- or a (return code, err/info string) pair if it has stopped '''
- return None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement