Generating list of possible configurations

bjorklund.emil at bjorklund.emil at
Wed Jul 2 23:53:30 CEST 2008

Hello pythonistas.

I'm a newbie to pretty much both programming and Python. I have a task
that involves writing a test script for every possible combination of
preference settings for a software I'm testing. I figured that this
was something that a script could probably do pretty easily, given all
the various possibilites.

I started creating a dictionary of all the settings, where each key
has a value that is a list of the possible values for that setting.
Most of the settings are simple booleans (setting is on or off), some
of them are drop-downs with several values. For example:

settings = {
    'setting_a': (True, False),
    'setting_b': (True, False),
    'setting_c': (1, 2, 3, 4),

After this I tried figuring out a function that would generate the
different possible configurations, but I couldn't quite wrap my head
around it... Are there any general patterns/structures that are suited
for this type of task? Any pointers as to how one would go about
solving something like this would be greatly appreciated. It's not
that I really need to use Python for it, but I thought it could be a
good learning excercise... :-)

Kind regards,

More information about the Python-list mailing list