When you do
for i in ckClassData:
Each i
is a CompKeyData
instance. You then do:
printTest(i)
Which calls:
for f in classData:
where classData
is the i
you passed in.
This iterates through the individual CompKeyData
instance, which (due to your implementation of __iter__
) assigns FirstName
, MiddleName
and LastName
in turn to f
- each of these is a string, and doesn't have FirstName
.
Instead, printTest
should be:
printTest(classData):
print classData.FirstName
You don't need to explicitly return None
, this happens automatically if you don't explicitly return
anything else.
Also, it is worth reading PEP-0008; following this will make your code more readable.