__init__(self,
master,
targets,
new_items,
child=None)
(Constructor)
|
|
Create an Alchemist object. Alchemists modify an object by changing a
target item to new item. For instance, an Alchemist:
- Might transmute the element of a particular atom
- Might change the item of a list to a new value
For enumeration, a series of Alchemists will work together to perform
all necessary mutations, each alchemist passing their mutated structures
on to another (child) alchemist. The general workflow looks like:
receive mutated_object from parent alchemist
for target in targets:
for new_item in new_items:
make a copy_of_mutated_object
change item at target in copy_of_mutated_object to new_item
pass copy_of_mutated_object to child alchemist
@type master: object
@param master: The master for this object. Can be a panel or other
object that has methods that get called by Alchemist methods. By
default, the Alchemist class calls master.transmutationCompleted with
each fully transmuted object.
@type targets: list
@param targets: list of possible positions for this Alchemist to mutate
@type new_items: list
@param new_items: list of items to change each target to.
@type child: L{Alchemist}
@param child: The Alchemist to call each time this Alchemist transmutes
an atom. If child is None, than this Alchemist is the last in the line.
- Overrides:
object.__init__
|