[英]Getting all possible value combinations
For an automatic test thing, I have a class with ~15 parameters. 对于自动测试的东西,我有一个包含~15个参数的类。 I want to automatically generate instances of the class for every possible value combination.
我想为每个可能的值组合自动生成类的实例。 For instance, if the class was defined like so:
例如,如果类定义如下:
class meep():
def __init__(self):
self.par1 = 0 # can be in range {0-3}
self.par2 = 1 # can be in range {1-2}
self.par3 = a # can be in range {a-c}
What is the most efficient to get instances of it with all possible value combinations? 使用所有可能的值组合获取它的实例效率最高的是什么? (IE
(IE
inst1=(par1=0,par2=1,par3=a),
inst2=(par1=0,par2=1,par3=b),
inst3=(par1=0,par2=1,par3=c),
inst4=(par1=1,par2=1,par3=a),
inst5=(par1=1,par2=1,par3=b),
inst6=(par1=1,par2=1,par3=c),
etc.) 等等。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.