Antoine Pitrou <pit...@free.fr> added the comment: `self.processName` could be a lazily computed property, since it doesn't seem to be used anywhere by default. Something like:
_processName = None @property def processName(self): n = self._processName if n is not None: return n if 'multiprocessing' not in sys.modules: n = 'mainProcess' else: n = sys.modules['multiprocessing'].current_process().name self._processName = n return n If you don't like the overhead of a property, you could do the caching dance in a __getattr__ method instead. NB : if 'multiprocessing' isn't in sys.modules, it means that you can only be in the main process, as far as I understand. Processes launched by multiprocessing itself *will* have 'multiprocessing' in sys.modules, unless it is doing really weird stuff. ---------- nosy: +pitrou _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7120> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com