January 2020
Intermediate to advanced
346 pages
9h 8m
English
The first powerful tool provided by the DEAP framework is the creator module. The creator module is used as a meta-factory, and it enables us to extend existing classes by augmenting them with new attributes.
For example, suppose we have a class called Employee. Using the creator tool, we can extend the Employee class by creating a Developer class as follows:
from deap import creatorcreator.create("Developer", Employee, position = "Developer", programmingLanguages = set) The first argument passed to the create() function is the desired name for the new class. The second argument is the existing class to be extended. Then, each additional argument defines an attribute for the new class. If the argument is assigned ...
Read now
Unlock full access