08-16-2018, 07:22 PM
(08-15-2018, 11:17 PM)Ofnuts Wrote:Code:
def createButtons(name,pairs):
optsclass=namedtuple(name+'Type',[symbol for symbol,label in pairs]+['labels'])
opts=optsclass(*(range(len(pairs))+[[(label,i) for i,(symbol,label) in enumerate(pairs)]]))
return opts
You've been super helpful, and I thank you a lot. I have a new respect for the power and flexibility of python, too.
I only have one more question. What would I look up to gain a better understanding of how the for/in syntax works in this code? I'm quite curious about it, but I don't even know what terminology it would fall under.