This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients amaury.forgeotdarc, benjamin.peterson, gvanrossum, pitrou, pjenvey, vinay.sajip
Date 2009-10-14.12:00:47
SpamBayes Score 0.003224553
Marked as misclassified No
Message-id <1255521651.79.0.229494206922.issue7120@psf.upfronthosting.co.za>
In-reply-to
Content
`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.
History
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: <1255521651.79.0.229494206922.issue7120@psf.upfronthosting.co.za>
2009-10-14 12:00:47pitroulinkissue7120 messages
2009-10-14 12:00:47pitroucreate