Factory for arrays of objects in python
- by Vorac
Ok, the title might be a little misleading.
I have a Window class that draws widgets inside itself in the constructor. The widgets are all of the same type.
So I pass a list of dictionaries, which contain the parameters for each widget. This works quite nicely, but I am worried that the interface to callers is obfuscated.
That is, in order to use Window, one has to study the class, construct a correct list of dictionaries, and then call the constructor with only one parameter - widgets_params.
Is this good or bad design? What alternatives does the python syntax provide?