Using python coroutines to implement easy of use state machines
charlie at openmoko.org
Tue May 27 08:41:51 CEST 2008
On Tue, 2008-05-27 at 07:48 +0200, Michael 'Mickey' Lauer wrote:
> Actually, last night I could not sleep at all and I think I found a way to do
> it with generators on the server side.
> I have no idea yet how to do it on client side (hiding the asynchronous nature
> of a dbus call) though, so that would be a good task for you.
Hehe I am like this too, can't sleep as long as there is an interesting
problem going one :-)
Aah, I just finished doing a simple "proof of concept" library to show
how it could work (server side). I am quite happy with it because it
allows generators OR callbacks syntax (in fact the library just provides
a wrapper to a callback mechanism), so it is very easy to use with the
gobject callback functions.
Beside, the code is very small ( but quite tricky ! )
Here is the code :
You can copy it and run it, have a look at the '__main__' function to
see usage example.
Let me know what you think, I would be interested to see how your idea
works. I can feel that there are several ways of implementing this kind
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part
More information about the smartphones-standards