I created a class:
class aTest:
name = ""
twoGroups = -1
continuous = -1
parametric = -1
covariates = -1
paired = -1
def __init__(self, name, twoGroups, continuous, parametric, covariates, paired):
self.name = name
self.twoGroups = twoGroups
self.continuous = continuous
self.parametric = parametric
self.covariates = covariates
self.paired = paired
And then created a list of class instances:
testList = []
testList.append(aTest("independent samples t-test", 1, 1, 1, 0, 0))
testList.append(aTest("dependent samples t-test", 1, 1, 1, 0, 1))
testList.append(aTest("Mann-Whitney U-test", 1, 1, 0, 0, 0))
testList.append(aTest("Wilcoxson matched pairs test", 1, 1, 0, 0, 1))
testList.append(aTest("one-way independent ANOVA", 0, 1, 1, 0, 0))
testList.append(aTest("Kruskall-Wallis test", 0, 1, 0, 0, 0))
testList.append(aTest("one-way repeated measures ANOVA", 0, 1, 1, 0, 1))
testList.append(aTest("Friedman's ANOVA", 0, 1, 0, 0, 1))
testList.append(aTest("ANCOVA", 0, 1, 1, 1, 0))
Then, finally, I tried to remove all the items in the list where the attribute parametric
was equal to 0:
print("Now, remove the nonparametric tests...")
for test in testList:
if test.parametric == 0:
testList.remove(test)
print("...and print what's left, with confirmation the attribute was 0")
for test in testList:
print(test.name+", "+str(test.parametric))
I get this result in the console:
> Now, remove the nonparametric tests...
> ...and print what's left, with confirmation the attribute was 0
> independent samples t-test, 1
> dependent samples t-test, 1
> Wilcoxson matched pairs test, 0
> one-way independent ANOVA, 1
> one-way repeated measures ANOVA, 1
> ANCOVA, 1
What's going on with the Wilcoxson matched pairs test
named object?