[Python-Dev] [Python-checkins] cpython: Issue #11223: Add threading._info() function providing informations about the

Victor Stinner victor.stinner at haypocalc.com
Wed Apr 20 23:53:55 CEST 2011


Le mercredi 20 avril 2011 à 11:57 -0500, Benjamin Peterson a écrit :
> 2011/4/20 Victor Stinner <victor.stinner at haypocalc.com>:
> > Le mercredi 20 avril 2011 à 20:24 +1000, Nick Coghlan a écrit :
> >> On Wed, Apr 20, 2011 at 6:20 PM, Victor Stinner
> >> <victor.stinner at haypocalc.com> wrote:
> >> > Hi,
> >> >
> >> > Le mardi 19 avril 2011 à 22:42 -0400, Terry Reedy a écrit :
> >> >> On 4/19/2011 5:59 PM, victor.stinner wrote:
> >> >>
> >> >> >    Issue #11223: Add threading._info() function providing informations about the
> >> >> > thread implementation.
> >> >>
> >> >> Since this is being documented, making it part of the public api, why
> >> >> does it have a leading underscore?
> >> >
> >> > Well, I suppose that this function might be specific to CPython. Do you
> >> > think that this function can/should be implemented in PyPy, Jython and
> >> > IronPython?
> >>
> >> I agree with your reasoning (and the leading underscore), but I
> >> suggest marking the docs with the implementation detail flag.
> >
> > I chose to return a dict to be flexible: any thread implementation may
> > add new specific keys. There is just one mandatory key: 'name', name of
> > the thread implementation (nt, os2, pthread or solaris for CPython 3.3).
> 
> How about using a structseq ala sys.float_info or sys.long_info? (In
> fact, we might want to put this in sys.)

Would you prefer something like the following example?

>>> sys.thread_info
sys.threadinfo(name='pthread', 'lock_implementation': 'semaphore',
version: 'NPTL 2.11.2')
>>> sys.thread_info
sys.threadinfo(name='nt', 'lock_implementation': 'semaphore', version:
'')
>>> sys.thread_info
sys.threadinfo(name='os2', 'lock_implementation': '', version: '')

Victor



More information about the Python-Dev mailing list