Is there a way to initialize all classes from a python module into a list of nameless objects?
Example
I have a module rules
which contains all child classes from a class Rule. Because of that, I'm certain they will all implement a method run()
and will have a attribute name
which will be generated during the call of __init__
I would like to have a list of objects dynamically initiated from those classes. By dynamically initialized i mean that they don't have to be named explicitly.
The questions are:
Is it possible to iterate through all classes in a module?
Can a nameless object be initiated?