[Python-Dev] Revised Proposal: thread.get_dict

Tim Peters tim.peters at gmail.com
Wed Jun 30 13:00:24 EDT 2004

>> It's probably better to add this to the (coded in Python) threading
>> module, and include the Python implementation there.  The threading
>> module can replace the Python implementation with something from the
>> (coded in C) thread module if possible.  This is so implementations
>> other than CPython get something usable right away (only CPython has
>> the C API, of course).

> So the C implementation would be in the thread module, perhaps
> under a funny name, but the official place to import it from is the
> threading module?

Exactly.  An ancient example of this approach is at the bottom of
string.py, which replaces some string.py Python functions with much
faster ones from the (coded in C) strop module, if strop exists.  A
recent example is in CVS heapq.py, which replaces Python bits with C
functions from _heapq (if available).

More information about the Python-Dev mailing list