[Python-Dev] Adding Python-Native Threads

Christian Tismer tismer at stackless.com
Thu Jun 30 21:05:29 CEST 2005


Michael Sparks wrote:

...

> Indeed - Greenlets allows you to build the functionality you propose without 
> having to change the language.
> 
> 
>>>For example, with Greenlets you would use the .switch() method of a 
>>
>>specific greenlet instance to switch to it, and with my python-native
>>threads you would use the global idle() function which would decide
>>for itself which thread to switch to.
> 
> 
> This is easy enough to build using greenlets today. I tried writing an
> experimental version of our generator scheduling system using greenlets
> rather than generators and found it to work very nicely. I'd suggest that if 
> you really want this functionality (I can understand why) that you revisit 
> greenlets - they probably do what you want.

I'd like to add that in most production code I saw so far,
people are much more happy with explicit switching of
(green|task)lets. The wish for free-running stuff like real
threads is a typical symptom in an early project phase.
When it becomes more serious, you will love to have as much
control as possible, and leave auto-switching to the very
rare cases like some background monitoring or other stuff
which is not really involved in you control/data flow.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/


More information about the Python-Dev mailing list