[Stackless] Stackless and Psyco
Bob Ippolito
bob at redivi.com
Mon Mar 1 21:17:17 CET 2004
On Mar 1, 2004, at 3:00 PM, Christopher Armstrong wrote:
> Bob Ippolito wrote:
>
>> A fourth option, I suppose, would be to use
>> yield Yet
>> yield Another
>> yield Style
>> yield of
>> yield explicitly
>> yield asynchronous
>> yield socket
>> yield code
>> but I don't there there is a good framework that supports this quite
>> yet (I've personally integrated such a beast with Twisted, and PEAK
>> events is similar, so I know this approach does work and is a bit
>> more sane than "raw" Twisted).
>
> I assume you have checked out twisted.flow? Oh right. I remember. You
> wrote the original 'flow' module and then cce stole the name ;-) I
> recently used it to port some blocking code to Twisted and it made me
> as happy as a clam :) Of course, it's not the most concise thing,
> requiring something like:
I still haven't used *the* twisted.flow, because my simpler flow worked
just fine and I understood it perfectly (being the author and all).
Doing exception handling with generator-style stuff SUUUUCKS though
(f.ex., no try:finally:). Next time I do a bunch of socket code, I'm
going to do it in stackless.. I've already started on a barebones
networking framework that will hopefully interoperate with existing
twisted, blocking-style, and medusa/asyncore style code.
> But it's still incredibly useful. I've been thinking about using
> bytecode hacks to implement a 'wait()' macro. You would say something
> like:
>
> def myCodeThatUsedToBlock():
> return wait(getDeferred())
>
> evil.flowify()
>
> And it would search the current module for functions that call 'wait',
> convert the 'wait' calls to the previous 'yield' dance, and
> automatically wrap them with functions that call flow.Deferred on
> their result... :-D
Yes, I considered this too, but it's far nicer to just use Stackless,
where foo.bar() can do *whatever it needs to do* :) That's why I like
it. I tried to do something like this with my original 'flow' --
however, I eventually remembered "explicit is better than implicit" and
"simple is better than complex" and I just let it go and did it the
straightforward way.
-bob
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list