Diving is deeper in an interesting python language, so there is no switch in the language as a construct. Thus, using dictionaries is the first choice of location after reading the first edition of python. So I tried how,
cases = { 2 : readt3(e,t,off, partElems, partsNodes),
3 : readq4(e,t,off, partElems, partsNodes),
5 : readh8(e,t,off, partElems, partsNodes),
}
def readt3( e, t, off, partElems, partsNodes, partPnt ):
partsElems[partPnt].append(e)
nods = t[offset: offset+3];
for n in nods:
partsNodes[partPnt].append(n)
return
And I got the error "readt3 is undefined", I thought I got it because it is not defined before the case, and then moved the function definitions above the cases, but still the same problem, but this time "e is not defined" I do not could understand this, so e is a parameter of the function, why am I getting a definition error related to e?
Where should the function definitions be given when emulating the switching case in this situation?