I gave a few different variations that actually might help on speeding up accessibility
#this method is less code and uses the dictionary object functionality and iterates through each list. with range you are creating an actual list of integers for that len in memory
if you want a faster way to store and access info inside the dictionary, the here are some options
jntsDict={}
jntsDict["leg"]={"left":["L_upLeg_JNT","L_knee_JNT","L_ankle_JNT"],
"right":["R_upLeg_JNT","R_knee_JNT","R_ankle_JNT"]}
jntsDict["arm"]={"left":["L_upArm_JNT","L_elbow_JNT","L_wrist_JNT"],
"right":["R_uparm_JNT","R_elbow_JNT","R_wrst_JNT"]}
for key, value in jntsDict.items():
for side in ['left', 'right']:
for v in value[side]:
print(v)
#or just store joint names and iterate through sides list and prefix the joint names
jntsDict={}
jntsDict["leg"]=["upLeg_JNT","knee_JNT","ankle_JNT"]
jntsDict["arm"]=["upArm_JNT","elbow_JNT","wrist_JNT"]
for key, value in jntsDict.items():
for side in ['L', 'R']:
for v in value:
print('%s_%s'%(side, v))
#or use more key information stored with each item as information so something like a quadruped could have different sides or center joints that don't have sides can be parsed in the same dictionary
jntsDict={}
jntsDict["spine"]={'joints':["spine_a_JNT","spine_b_JNT","spine_c_JNT"]}
jntsDict["leg"]={'sides':['L', 'R'], 'joints':["upLeg_JNT","knee_JNT","ankle_JNT"]}
jntsDict["arm"]={'sides':['L', 'R'], 'joints':["upArm_JNT","elbow_JNT","wrist_JNT"]}
jntsDict["quadleg"]={'sides':['FL', 'FR', 'BL', 'BR'], 'joints':["upLeg_JNT","knee_JNT","ankle_JNT"]}
for key,value in jntsDict.items():
if value.get('sides'):
for side in value.get('sides'):
for j in value.get('joints'):
print('%s_%s'%(side, j))
else:
for j in value.get('joints'):
print(j)