Help with a non pythonic way to test point distances using tree structure

new.gh (21.9 KB)

I was thinking of sorting and getting values of points here in an easy way, wanted to script, but the minute I call the tree into python, my com locks up…theres 4 cardinal points in every square, and i sorted them and wanna manipulate such that its suppose to test the points in the square against all 4 cardinal points, take the shortest distance to any of the 4 points, then return me that numbers in a nested list to manipulate.
diagram:


in the tree, branch 1 of points tests against branch 1 of cardinal points and outputs another tree of {0}, {1}, etc and contents of numbers aka distance corresponding to however many points in branch 1 of points

internalize your input points please
in the dark, I can suggest you look into import ghpythonlib.treehelpers
it would turn tree into nested lists, which are easier to manipulate