At first: Idk. what the variable "o" stands for, but if you have to do a for-loop in range(-400000, 400000) you're probably messing something logically up.
On the other hand, if you REALLY need such a big range, use clusters to split you're long list into short ones and then iterate with threads through these lists, use a while-loop, that only executes for the neccesary fields, which you have to check somehow or use a generator, which won't save the list, but which can theoratically generate infinite values for you, which you could use.
I hope I could help a bit or give you some ideas.
King Regards
Cyber