April 2024 - This site, and Kamaelia are being updated. There is significant work needed, and PRs are welcome.
1. Microprocesses - A Generator with Context
Axon is built on top of generators with some added context. Whilst the most common version of this a user actually uses is called a component, this is a specialisation of the general concept - a generator with context.
Exercise: Write a class called microprocess (make sure you subclass "object" !) with the following methods:
__init__(self)
main(self)
Answer:
Discussion:
Clearly we can create a handful of these now:
Calling their main method results in us being given a generator:
We can then run these generators in the usual way (though these are fairly boring microprocesses):
OK, so we have a mechanism for adding context to generators, and we've called that a microprocess. Let's make it simple to set lots of these running.