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

Antoine Pitrou solipsis at pitrou.net
Tue Jun 7 10:22:56 CEST 2011


On Tue, 7 Jun 2011 12:47:37 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> 
> 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).

Well, Process.ident returns None as well ;)

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

Well, it depends. For example, closed files raise a ValueError when you
try to do operations on them. I tend to think of RuntimeError as
something that happens without any clear responsibility from the user,
although that's debatable (recursion errors can occur because of a
programming bug, but also simply because a structure is nested much too
deeply).

Of course, current coding practice in other multiprocessing.Process
methods and properties doesn't help, since it uses asserts to guard
against misuse!

Regards

Antoine.




More information about the Python-checkins mailing list