Author pitrou
Recipients amaury.forgeotdarc, benjamin.peterson, gvanrossum, pitrou, pjenvey, vinay.sajip
Date 2009-10-14.12:00:47
SpamBayes Score 0.00322455
Marked as misclassified No
Message-id <>
`self.processName` could be a lazily computed property, since it doesn't
seem to be used anywhere by default. Something like:

    _processName = None

    def processName(self):
        n = self._processName
        if n is not None:
            return n
        if 'multiprocessing' not in sys.modules:
            n = 'mainProcess'
            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.
Date User Action Args
2009-10-14 12:00:51pitrousetrecipients: + pitrou, gvanrossum, vinay.sajip, amaury.forgeotdarc, pjenvey, benjamin.peterson
2009-10-14 12:00:51pitrousetmessageid: <>
2009-10-14 12:00:47pitroulinkissue7120 messages
2009-10-14 12:00:47pitroucreate