Hmm. I'm fairly new to Python so I would really appreciate it if you could elaborate here.
I checked the list and it is in a correct order:
[u'B_L_Hip_Uppr', u'B_L_Hip_Lowr', u'B_L_Knee', u'B_L_Ankle', u'B_L_ball', u'B_L_Toes']
It seems like it happens only if the last joint selected(before creation of the IK) is ankle, ball or toes. What could be causing this bizarre behavior?
But then again, I just drew a random skeleton without reorienting the chain and tried this script = instant flip