[Python-Dev] [Python-checkins] cpython: Issue #12040: Expose a new attribute `sentinel` on instances of

Nick Coghlan ncoghlan at gmail.com
Tue Jun 7 04:47:37 CEST 2011


On Tue, Jun 7, 2011 at 3:36 AM, antoine.pitrou
<python-checkins at python.org> wrote:
> +    @property
> +    def sentinel(self):
> +        '''
> +        Return a file descriptor (Unix) or handle (Windows) suitable for
> +        waiting for process termination.
> +        '''
> +        try:
> +            return self._sentinel
> +        except AttributeError:
> +            raise ValueError("process not started")
> +

We should probably follow this model for threading.Thread.ident as
well (i.e. throwing an exception rather than returning None if the
thread hasn't been started yet).

Also, for runtime state errors, we tend to use RuntimeError rather
than ValueError (e.g. see the errors thrown by
contextlib._GeneratorContextManager)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list